wl-pprint-extras 3.0.0.1 → 3.2
raw patch · 2 files changed
+36/−7 lines, 2 files
Files
Text/PrettyPrint/Free/Internal.hs view
@@ -123,6 +123,8 @@ import Data.Functor.Apply import Data.Functor.Bind 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 Data.List.NonEmpty (NonEmpty)@@ -523,6 +525,33 @@ instance Pretty Int where pretty = text . show +instance Pretty Int8 where+ pretty = text . show++instance Pretty Int16 where+ pretty = text . show++instance Pretty Int32 where+ pretty = text . show++instance Pretty Int64 where+ pretty = text . show++instance Pretty Word where+ pretty = text . show++instance Pretty Word8 where+ pretty = text . show++instance Pretty Word16 where+ pretty = text . show++instance Pretty Word32 where+ pretty = text . show++instance Pretty Word64 where+ pretty = text . show+ instance Pretty Integer where pretty = text . show @@ -693,15 +722,15 @@ = Empty | Char {-# UNPACK #-} !Char -- invariant: char is not '\n' | Text {-# UNPACK #-} !Int String -- invariant: text doesn't contain '\n'- | Line !Bool -- True <=> when undone by group, do not insert a space+ | Line !(Maybe Char) -- Nothing <=> when undone by group, do not insert a space | Cat (Doc e) (Doc e) | Nest {-# UNPACK #-} !Int (Doc e) | Union (Doc e) (Doc e) -- invariant: first lines of first doc longer than the first lines of the second doc | Effect e | Column (Int -> Doc e) | Nesting (Int -> Doc e)- | Columns (Int -> Doc e) - | Ribbon (Int -> Doc e) + | Columns (Int -> Doc e)+ | Ribbon (Int -> Doc e) instance Functor Doc where fmap _ Empty = Empty@@ -815,13 +844,13 @@ -- current nesting level. Document @line@ behaves like @(text \" \")@ -- if the line break is undone by 'group'. line :: Doc e-line = Line False+line = Line (Just ' ') -- | The @linebreak@ document advances to the next line and indents to -- the current nesting level. Document @linebreak@ behaves like -- 'empty' if the line break is undone by 'group'. linebreak :: Doc e-linebreak = Line True+linebreak = Line Nothing -- | The document @(nest i x)@ renders document @x@ with the current -- indentation level increased by i (See also 'hang', 'align' and@@ -860,7 +889,7 @@ flatten :: Doc e -> Doc e flatten (Cat x y) = Cat (flatten x) (flatten y) flatten (Nest i x) = Nest i (flatten x)-flatten (Line brk) = if brk then Empty else Text 1 " "+flatten (Line brk) = maybe Empty Char brk flatten (Union x _) = flatten x flatten (Column f) = Column (flatten . f) flatten (Nesting f) = Nesting (flatten . f)
wl-pprint-extras.cabal view
@@ -1,6 +1,6 @@ name: wl-pprint-extras category: Control, Monads, Text-version: 3.0.0.1+version: 3.2 cabal-version: >= 1.6 license: BSD3 license-file: LICENSE