wl-pprint-extras 3.3 → 3.4
raw patch · 2 files changed
+23/−12 lines, 2 filesdep +text
Dependencies added: text
Files
src/Text/PrettyPrint/Free/Internal.hs view
@@ -125,8 +125,12 @@ import Data.Functor.Plus import Data.Int import Data.Word-import qualified Data.ByteString.UTF8 as Strict-import qualified Data.ByteString.Lazy.UTF8 as Lazy+import qualified Data.ByteString.UTF8 as B+import qualified Data.ByteString.Lazy.UTF8 as BL+import qualified Data.Text as T+import qualified Data.Text.Encoding as T+import qualified Data.Text.Lazy as TL+import qualified Data.Text.Lazy.Encoding as TL import Data.List.NonEmpty (NonEmpty) import Numeric.Natural (Natural) import Control.Applicative@@ -244,7 +248,7 @@ sep = group . vsep -- | The document @(fillSep xs)@ concatenates documents @xs@--- horizontally with @(\<+\>)@ as long as its fits the page, than+-- horizontally with @(\<+\>)@ as long as its fits the page, then -- inserts a @line@ and continues doing that for all documents in -- @xs@. --@@ -299,7 +303,7 @@ cat = group . vcat -- | The document @(fillCat xs)@ concatenates documents @xs@--- horizontally with @(\<\>)@ as long as its fits the page, than inserts+-- horizontally with @(\<\>)@ as long as its fits the page, then inserts -- a @linebreak@ and continues doing that for all documents in @xs@. -- -- > fillCat xs = foldr (<//>) empty xs@@ -497,12 +501,18 @@ -- instance Pretty (Doc ()) where -- pretty = id -instance Pretty Strict.ByteString where- pretty = pretty . Strict.toString+instance Pretty B.ByteString where+ pretty = pretty . B.toString -instance Pretty Lazy.ByteString where- pretty = pretty . Lazy.toString+instance Pretty BL.ByteString where+ pretty = pretty . BL.toString +instance Pretty T.Text where+ pretty = pretty . T.encodeUtf8++instance Pretty TL.Text where+ pretty = pretty . TL.encodeUtf8+ instance Pretty () where pretty () = text "()" @@ -582,7 +592,7 @@ ----------------------------------------------------------- -- | The document @(fillBreak i x)@ first renders document @x@. It--- than appends @space@s until the width is equal to @i@. If the+-- then appends @space@s until the width is equal to @i@. If the -- width of @x@ is already larger than @i@, the nesting level is -- increased by @i@ and a @line@ is appended. When we redefine @ptype@ -- in the previous example to use @fillBreak@, we get a useful@@ -605,7 +615,7 @@ else text (spaces (f - w)) --- | The document @(fill i x)@ renders document @x@. It than appends+-- | The document @(fill i x)@ renders document @x@. It then appends -- @space@s until the width is equal to @i@. If the width of @x@ is -- already larger, nothing is appended. This combinator is quite -- useful in practice to output a list of bindings. The following
wl-pprint-extras.cabal view
@@ -1,6 +1,6 @@ name: wl-pprint-extras category: Control, Monads, Text-version: 3.3+version: 3.4 cabal-version: >= 1.6 license: BSD3 license-file: LICENSE@@ -28,7 +28,8 @@ nats >= 0.1, semigroups >= 0.9, semigroupoids >= 3,- utf8-string >= 0.3.6 && < 0.4+ utf8-string >= 0.3.6 && < 0.4,+ text == 0.11.* exposed-modules: Text.PrettyPrint.Free