packages feed

ansi-wl-pprint 0.5.1 → 0.6.1

raw patch · 3 files changed

+32/−27 lines, 3 filesdep ~ansi-terminaldep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: ansi-terminal, base

API changes (from Hackage documentation)

- Text.PrettyPrint.ANSI.Leijen: instance Pretty a => Pretty (Maybe a)
- Text.PrettyPrint.ANSI.Leijen: instance Pretty a => Pretty [a]
- Text.PrettyPrint.ANSI.Leijen: plain :: Doc -> Doc
+ Text.PrettyPrint.ANSI.Leijen: instance (Pretty a) => Pretty (Maybe a)
+ Text.PrettyPrint.ANSI.Leijen: instance (Pretty a) => Pretty [a]
+ Text.PrettyPrint.ANSI.Leijen: instance Monoid Doc
+ Text.PrettyPrint.ANSI.Leijen: removeANSIFormatting :: Doc -> Doc
- Text.PrettyPrint.ANSI.Leijen: pretty :: Pretty a => a -> Doc
+ Text.PrettyPrint.ANSI.Leijen: pretty :: (Pretty a) => a -> Doc
- Text.PrettyPrint.ANSI.Leijen: prettyList :: Pretty a => [a] -> Doc
+ Text.PrettyPrint.ANSI.Leijen: prettyList :: (Pretty a) => [a] -> Doc

Files

Text/PrettyPrint/ANSI/Example.hs view
@@ -17,8 +17,4 @@     putStr $ show $ green (text "I will be green on Unix but uncolored on Windows") <> linebreak          -- Let's see some non-color formatting:-    putDoc $ text "We can do" <+> bold (text "boldness") <> text ", if your terminal supports it, and even perhaps" <+> underline (text "underlining") <> linebreak--    -- Just a little test of the formatting removal:-    putDoc $ text "There is a handy utility called 'plain' to" <+> plain (bold $ text "remove formatting") <+>-              plain (text "if you need to e.g. support" <+> red (text "non-ANSI") <+> text "terminals")+    putDoc $ text "We can do" <+> bold (text "boldness") <> text ", if your terminal supports it, and even perhaps" <+> underline (text "underlining")
Text/PrettyPrint/ANSI/Leijen.hs view
@@ -124,7 +124,7 @@    underline, deunderline,     -- * Removing formatting-   plain,+   removeANSIFormatting,     -- * Primitive type documents    string, int, integer, float, double, rational,@@ -151,6 +151,7 @@ import Control.Monad (when)  import Data.Maybe (isNothing, fromMaybe, catMaybes)+import Data.Monoid   infixr 5 </>,<//>,<$>,<$$>@@ -762,6 +763,14 @@                 | SSGR [SGR] SimpleDoc  +-- MCB: Not in the wl-pprint package that we forked from. I added this when+-- the "pretty" package from base gained a Monoid instance:+instance Monoid Doc where+    mempty = empty+    mappend = (<$$>)+    mconcat = vcat++ -- | The empty document is, indeed, empty. Although @empty@ has no -- content, it does have a \'height\' of 1 and behaves exactly like -- @(text \"\")@ (and is therefore not a unit of @\<$\>@).@@ -1001,21 +1010,21 @@ -----------------------------------------------------------  -- | Removes all colorisation, emboldening and underlining from a document-plain :: Doc -> Doc-plain e@Empty         = e-plain c@(Char _)      = c-plain t@(Text _ _)    = t-plain l@(Line _)      = l-plain (Cat x y)       = Cat (plain x) (plain y)-plain (Nest i x)      = Nest i (plain x)-plain (Union x y)     = Union (plain x) (plain y)-plain (Column f)      = Column (plain . f)-plain (Nesting f)     = Nesting (plain . f)-plain (Color _ _ _ x) = plain x-plain (Intensify _ x) = plain x-plain (Italicize _ x) = plain x-plain (Underline _ x) = plain x-plain (RestoreFormat _ _ _ _ _) = Empty+removeANSIFormatting :: Doc -> Doc+removeANSIFormatting e@Empty         = e+removeANSIFormatting c@(Char _)      = c+removeANSIFormatting t@(Text _ _)    = t+removeANSIFormatting l@(Line _)      = l+removeANSIFormatting (Cat x y)       = Cat (removeANSIFormatting x) (removeANSIFormatting y)+removeANSIFormatting (Nest i x)      = Nest i (removeANSIFormatting x)+removeANSIFormatting (Union x y)     = Union (removeANSIFormatting x) (removeANSIFormatting y)+removeANSIFormatting (Column f)      = Column (removeANSIFormatting . f)+removeANSIFormatting (Nesting f)     = Nesting (removeANSIFormatting . f)+removeANSIFormatting (Color _ _ _ x) = removeANSIFormatting x+removeANSIFormatting (Intensify _ x) = removeANSIFormatting x+removeANSIFormatting (Italicize _ x) = removeANSIFormatting x+removeANSIFormatting (Underline _ x) = removeANSIFormatting x+removeANSIFormatting (RestoreFormat _ _ _ _ _) = Empty  ----------------------------------------------------------- -- Renderers
ansi-wl-pprint.cabal view
@@ -1,5 +1,5 @@ Name:                ansi-wl-pprint-Version:             0.5.1+Version:             0.6.1 Cabal-Version:       >= 1.2 Category:            User Interfaces, Text Synopsis:            The Wadler/Leijen Pretty Printer for colored ANSI terminal output@@ -12,7 +12,7 @@ Homepage:            http://github.com/batterseapower/ansi-wl-pprint Build-Type:          Simple -Flag Base3+Flag NewBase         Description:    Choose the new smaller, split-up base package with 6.10         Default:        True @@ -24,8 +24,8 @@ Library         Exposed-Modules:        Text.PrettyPrint.ANSI.Leijen         -        Build-Depends:          ansi-terminal >= 0.4.0-        if flag(base3)+        Build-Depends:          ansi-terminal >= 0.4.0 && < 0.6+        if flag(newbase)                 Build-Depends:  base >= 3 && < 5         else                 Build-Depends:  base < 3@@ -33,8 +33,8 @@ Executable ansi-wl-pprint-example         Main-Is:                Text/PrettyPrint/ANSI/Example.hs         -        Build-Depends:          ansi-terminal >= 0.4.0-        if flag(base3)+        Build-Depends:          ansi-terminal >= 0.4.0 && < 0.6+        if flag(newbase)                 Build-Depends:  base >= 3 && < 5         else                 Build-Depends:  base < 3