CurryInfo: wl-pprint-3.0.0 / Text.PrettyImpl.normalise

definition:
normalise :: Tokens -> Tokens
normalise = go id
  where
  go co EOD                = co EOD
  go co (Empty         ts) = go co ts
  -- there should be no deferred opening brackets
  go co (OpenGroup     ts) = go (co . open)        ts
  go co (CloseGroup    ts) = go (co . CloseGroup)  ts
  go co (LineBreak  ms ts) = (co . LineBreak ms . go id) ts
  go co (Text       s  ts) = Text s       (go co ts)
  go co (OpenNest   n  ts) = OpenNest   n (go co ts)
  go co (CloseNest     ts) = CloseNest    (go co ts)
  go co (OpenFormat f  ts) = OpenFormat f (go co ts)
  go co (CloseFormat   ts) = CloseFormat  (go co ts)

  open t = case t of
    CloseGroup ts -> ts
    _             -> OpenGroup t
demand:
no demanded arguments
deterministic:
deterministic operation
documentation:
-- Normalise a token sequence using the following rewriting rules:
--
--   CloseGroup (Text     s ts) => Text s (CloseGroup ts)
--   OpenGroup  (Text     s ts) => Text s (OpenGroup  ts)
--   OpenGroup  (CloseGroup ts) => ts
--
-- Rewriting moves `Text` tokens in and out of groups. The set of `lines`
-- "belonging" to each group, i.e., the set of layouts, is left unchanged.
failfree:
()
indeterministic:
referentially transparent operation
infix:
no fixity defined
iotype:
{() |-> {normalise.go.168}}
name:
normalise
precedence:
no precedence defined
result-values:
{normalise.go.168}
signature:
Tokens -> Tokens
solution-complete:
operation might suspend on free variables
terminating:
possibly non-terminating
totally-defined:
reducible on all ground data terms