packages feed

mainland-pretty 0.1.0.3 → 0.1.1.0

raw patch · 2 files changed

+21/−2 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Text.PrettyPrint.Mainland: renderCompact :: Doc -> RDoc
- Text.PrettyPrint.Mainland: class Pretty a
+ Text.PrettyPrint.Mainland: class Pretty a where ppr = pprPrec 0 pprPrec _ = ppr pprList xs = list (map ppr xs)

Files

Text/PrettyPrint/Mainland.hs view
@@ -86,7 +86,7 @@     RDoc(..),      -- * Document rendering-    render,+    render, renderCompact,     displayS, prettyS, pretty,     displayPragmaS, prettyPragmaS, prettyPragma, @@ -431,6 +431,25 @@ -- | Render a document given a maximum width. render :: Int -> Doc -> RDoc render w x = best w 0 x++-- | Render a document without indentation on infinitely long lines. Since no+-- \'pretty\' printing is involved, this renderer is fast. The resulting output+-- contains fewer characters.+renderCompact :: Doc -> RDoc+renderCompact doc = scan 0 [doc]+  where+    scan _ []     = REmpty+    scan k (d:ds) = case d of+                      Empty     -> scan k ds+                      Char c    -> let k' = k+1 in k' `seq` RChar c (scan k' ds)+                      Text l s  -> let k' = k+l in k' `seq` RText l s (scan k' ds)+                      Line      -> RLine 0 (scan 0 ds)+                      Nest _ x  -> scan k (x:ds)+                      SrcLoc _  -> scan k ds+                      Cat x y   -> scan k (x:y:ds)+                      Alt x _   -> scan k (x:ds)+                      Column f  -> scan k (f k:ds)+                      Nesting f -> scan k (f 0:ds)  -- | Display a rendered document. displayS :: RDoc -> ShowS
mainland-pretty.cabal view
@@ -1,5 +1,5 @@ name:           mainland-pretty-version:        0.1.0.3+version:        0.1.1.0 cabal-version:  >= 1.6 license:        BSD3 license-file:   LICENSE