packages feed

wl-pprint-console 0.0.1.1 → 0.0.1.2

raw patch · 2 files changed

+26/−20 lines, 2 filesdep ~console-stylePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: console-style

API changes (from Hackage documentation)

Files

src/Text/PrettyPrint/Console/WL.hs view
@@ -17,7 +17,7 @@ module Text.PrettyPrint.Console.WL (   module Text.PrettyPrint.Annotated.WL -  -- * Display documents annotated with pair of strings+  -- * Display documents annotated with pairs of strings   , displayWrapped, displayWrappedT, displayWrappedS    -- * Display as HTML@@ -47,7 +47,7 @@     '>' -> "&gt;"     _   -> [c] --- | Display a rendered document which is annotated with pairs of strings and+-- | Display a rendered document which is annotated with pairs of strings @(String,String)@ and -- output a 'Monoid'. -- -- The first element of the pair is prepended to the annotated region,@@ -55,7 +55,7 @@ displayWrapped :: Monoid o => (String -> o) -> SimpleDoc (String, String) -> o displayWrapped f = displayDecorated (f . fst) (f . snd) f --- | Display a rendered document which is annotated with pairs of strings and+-- | Display a rendered document which is annotated with pairs of strings @(String,String)@ and -- output 'Text'. -- -- The first element of the pair is prepended to the annotated region,@@ -63,7 +63,7 @@ displayWrappedT :: SimpleDoc (String, String) -> TL.Text displayWrappedT = TL.toLazyText . displayWrapped TL.fromString --- | Display a rendered document which is annotated with pairs of strings and+-- | Display a rendered document which is annotated with pairs of strings @(String,String)@ and -- output a 'ShowS' function. -- -- The first element of the pair is prepended to the annotated region,@@ -73,7 +73,7 @@  -- | Display a rendered document as HTML and output a 'Monoid'. ----- The annotated region is wrapped by 'span' with the 'class' attribute+-- The annotated region is wrapped by @<span class="f a">..</span>@ with the @class@ attribute -- given by the annotation function. displayHTML :: Monoid o => (String -> o) -> (a -> String) -> SimpleDoc a -> o displayHTML f g = displayDecorated push pop str@@ -83,25 +83,29 @@  -- | Display a rendered document as HTML and output 'Text'. ----- The annotated region is wrapped by 'span' with the 'class' attribute+-- The annotated region is wrapped by @<span class="f a">..</span>@ with the @class@ attribute -- given by the annotation function. displayHTMLT :: (a -> String) -> SimpleDoc a -> TL.Text displayHTMLT f = TL.toLazyText . displayHTML TL.fromString f  -- | Display a rendered document as HTML and output a 'ShowS' function. ----- The annotated region is wrapped by 'span' with the 'class' attribute+-- The annotated region is wrapped by @<span class="f a">..</span>@ with the @class@ attribute -- given by the annotation function. displayHTMLS :: (a -> String) -> SimpleDoc a -> ShowS displayHTMLS f = (++) . displayHTML id f  -- | Display a rendered document with ANSI escape sequences and output a 'Monoid'. ----- The annotations are mapped to a '[SetStyle]' array.+-- The annotations are mapped to a @[SetStyle]@ array. displayStyleCode :: Monoid o => (String -> o) -> (a -> [SetStyle]) -> Term -> SimpleDoc a -> o-displayStyleCode f g term = runStyle term . displayDecoratedA push pop (pure . f)- where push  x = f <$> styleCode (Save:g x)-       pop   _ = f <$> styleCode (Restore:[])+displayStyleCode f g t d = runStyle t $+  mappend <$>+  displayDecoratedA push pop str d <*>+  (f <$> applyStyleCode)+  where push  x = changeStyle (Save:g x) >> pure mempty+        pop   _ = changeStyle [Restore]  >> pure mempty+        str   s = f . (`mappend` s) <$> applyStyleCode  -- | Display a rendered document with ANSI escape sequences and output a 'ShowS' function. --@@ -119,9 +123,11 @@ -- -- The annotations are mapped to a '[SetStyle]' array. hDisplayStyle :: MonadIO m => Handle -> (a -> [SetStyle]) -> SimpleDoc a -> m ()-hDisplayStyle h f = hRunWithStyle h [] . displayDecoratedA push pop (liftIO . hPutStr h)- where push  x = setStyle (Save:f x)-       pop   _ = setStyle (Restore:[])+hDisplayStyle h f d = hRunWithStyle h [] $+  displayDecoratedA push pop str d >> applyStyle+  where push  x = changeStyle (Save:f x)+        pop   _ = changeStyle [Restore]+        str   s = applyStyle >> liftIO (hPutStr h s)  -- | Display a rendered document with ANSI escape sequences to 'stdout'. --@@ -129,14 +135,14 @@ displayStyle :: MonadIO m => (a -> [SetStyle]) -> SimpleDoc a -> m () displayStyle = hDisplayStyle stdout --- | The action @(putDocStyle f doc)@ pretty prints document @doc@ to standard output+-- | The action @(putDocStyle f doc)@ pretty prints @doc@ to 'stdout' -- using the annotations. -- -- The annotations are mapped by @f@ to @[SetStyle]@ arrays. putDocStyle :: (a -> [SetStyle]) -> Doc a -> IO () putDocStyle = hPutDocStyle stdout --- | The action @(hPutDocStyle handle f doc)@ pretty prints document @doc@ to file handle @handle@+-- | The action @(hPutDocStyle handle f doc)@ pretty prints @doc@ to file handle @handle@ -- using the annotations. -- -- The annotations are mapped by @f@ to @[SetStyle]@ arrays.
wl-pprint-console.cabal view
@@ -3,9 +3,9 @@ -- see: https://github.com/sol/hpack  name:           wl-pprint-console-version:        0.0.1.1-synopsis:       Wadler/Leijen style pretty printer supporting colorful console output.-description:    Wadler/Leijen style pretty printer with support for annotations and colorful console output. Additional useful display routines are provided, e.g, for HTML output.+version:        0.0.1.2+synopsis:       Wadler/Leijen pretty printer supporting colorful console output.+description:    Wadler/Leijen pretty printer with support for annotations and colorful console output. Additional useful display routines are provided, e.g, for HTML output. category:       Text stability:      experimental homepage:       https://github.com/minad/wl-pprint-console#readme@@ -29,7 +29,7 @@   ghc-options: -Wall   build-depends:       base                >= 4.8 && < 5-    , console-style       >= 0.0.1.2 && < 0.1+    , console-style       >= 0.0.2.0 && < 0.1     , wl-pprint-annotated >= 0.0.1.2 && < 0.1     , mtl                 >= 2.2 && < 2.4     , text                >= 0.11 && < 1.3