packages feed

show-prettyprint 0.2.0.2 → 0.2.1

raw patch · 4 files changed

+19/−4 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Text.Show.Prettyprint: prettifyToDoc :: String -> Doc ann
+ Text.Show.Prettyprint.Internal: parseShowString :: String -> Result (Doc ann)

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.2.1++Add function+ # 0.2.0.1  Tagged the wrong version as 0.2 on Github. Releasing a new version with an
show-prettyprint.cabal view
@@ -1,5 +1,5 @@ name:                show-prettyprint-version:             0.2.0.2+version:             0.2.1 synopsis:            Robust prettyprinter for output of auto-generated Show                      instances description:         See README.md
src/Text/Show/Prettyprint.hs view
@@ -23,6 +23,8 @@ --          ,("world",Right (Record {r1 = ('c',-1.2e34),r2 = 123}))] module Text.Show.Prettyprint (     prettifyShow,+    prettifyToDoc,+     prettyShow,     prettyPrint, ) where@@ -31,6 +33,7 @@  import Text.Trifecta +import Data.Text.Prettyprint.Doc      (Doc, pretty) import Text.Show.Prettyprint.Internal  @@ -40,12 +43,10 @@ -- >>> data Pair a b = Pair a b deriving Show -- >>> import Data.Map (fromList) -- -- | Prettyprint a string produced by 'show'. On parse error, silently fall back -- to a non-prettyprinted version. prettifyShow :: String -> String-prettifyShow s = case parseString shownP mempty s of+prettifyShow s = case parseShowString s of     Success x -> show x     Failure _ -> s @@ -56,3 +57,10 @@ -- | 'prettifyShow' with the 'show' and the 'putStrLn' baked in. prettyPrint :: Show a => a -> IO () prettyPrint = putStrLn . prettyShow++-- | Like 'prettifyShow', but maps to a 'Doc' for easier interoperability with+-- the @prettyprinter@ package.+prettifyToDoc :: String -> Doc ann+prettifyToDoc s = case parseShowString s of+    Success x -> x+    Failure _ -> pretty s
src/Text/Show/Prettyprint/Internal.hs view
@@ -3,6 +3,7 @@ -- | __This module may change arbitrarily between versions.__ It is exposed only -- for documentary purposes. module Text.Show.Prettyprint.Internal (+    parseShowString,     shownP,     valueP,     identifierP,@@ -34,6 +35,8 @@ -- :}  +parseShowString :: String -> Result (Doc ann)+parseShowString = parseString shownP mempty  -- | Prettyparser for a 'show'-generated string shownP :: Parser (Doc ann)