packages feed

pretty-simple 0.2.0.0 → 0.3.0.0

raw patch · 2 files changed

+49/−14 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Text.Pretty.Simple: NoColor :: UseColor
+ Text.Pretty.Simple: OutputOptions :: Int -> UseColor -> OutputOptions
+ Text.Pretty.Simple: UseColor :: UseColor
+ Text.Pretty.Simple: [_indentAmount] :: OutputOptions -> Int
+ Text.Pretty.Simple: [_useColor] :: OutputOptions -> UseColor
+ Text.Pretty.Simple: data OutputOptions
+ Text.Pretty.Simple: data UseColor
+ Text.Pretty.Simple: defaultOutputOptions :: OutputOptions
+ Text.Pretty.Simple: noColorOutputOptions :: OutputOptions
+ Text.Pretty.Simple: pPrintNoColor :: (MonadIO m, Show a) => a -> m ()
+ Text.Pretty.Simple: pPrintOpt :: (MonadIO m, Show a) => OutputOptions -> a -> m ()
+ Text.Pretty.Simple: pShowNoColor :: Show a => a -> String
+ Text.Pretty.Simple: pShowOpt :: Show a => OutputOptions -> a -> String
+ Text.Pretty.Simple: pStringNoColor :: String -> String
+ Text.Pretty.Simple: pStringOpt :: OutputOptions -> String -> String

Files

pretty-simple.cabal view
@@ -1,5 +1,5 @@ name:                pretty-simple-version:             0.2.0.0+version:             0.3.0.0 synopsis:            Simple pretty printer for any datatype with a 'Show' instance. description:         Please see README.md homepage:            https://github.com/cdepillabout/pretty-simple
src/Text/Pretty/Simple.hs view
@@ -16,9 +16,23 @@  -} module Text.Pretty.Simple-  ( pShow+  (+  -- * Output With Color+    pShow   , pPrint   , pString+  -- * Output With NO Color+  , pShowNoColor+  , pPrintNoColor+  , pStringNoColor+  -- * Output With Output Options+  , pShowOpt+  , pPrintOpt+  , pStringOpt+  , OutputOptions(..)+  , UseColor(..)+  , defaultOutputOptions+  , noColorOutputOptions   -- * Examples   -- $examples   ) where@@ -32,33 +46,54 @@ import Control.Monad.IO.Class (MonadIO, liftIO)  import Text.Pretty.Simple.Internal-       (defaultOutputOptions, expressionParse, expressionsToOutputs,-        render)+       (OutputOptions(..), UseColor(..), defaultOutputOptions,+        expressionParse, expressionsToOutputs, render)  pPrint :: (MonadIO m, Show a) => a -> m ()-pPrint = liftIO . putStrLn . pShow+pPrint = pPrintOpt defaultOutputOptions  pShow :: Show a => a -> String-pShow = pString . show+pShow = pShowOpt defaultOutputOptions  pString :: String -> String-pString string =+pString = pStringOpt defaultOutputOptions++pPrintNoColor :: (MonadIO m, Show a) => a -> m ()+pPrintNoColor = pPrintOpt noColorOutputOptions++pShowNoColor :: Show a => a -> String+pShowNoColor = pShowOpt noColorOutputOptions++pStringNoColor :: String -> String+pStringNoColor = pStringOpt noColorOutputOptions++noColorOutputOptions :: OutputOptions+noColorOutputOptions = defaultOutputOptions {_useColor = NoColor}++pPrintOpt :: (MonadIO m, Show a) => OutputOptions -> a -> m ()+pPrintOpt outputOptions = liftIO . putStrLn . pShowOpt outputOptions++pShowOpt :: Show a => OutputOptions -> a -> String+pShowOpt outputOptions = pStringOpt outputOptions . show++pStringOpt :: OutputOptions -> String -> String+pStringOpt outputOptions string =   case expressionParse string of     Left _ -> string     Right expressions ->-      render defaultOutputOptions $ expressionsToOutputs expressions+      render outputOptions $ expressionsToOutputs expressions  -- $examples -- Simple Haskell datatype: -- -- >>> data Foo a = Foo a String deriving Show ----- >>> pPrint $ Foo 3 "hello"+-- >>> pPrintNoColor $ Foo 3 "hello" -- Foo 3 "hello" -- -- Lists: ----- >>> pPrint $ [1,2,3]+-- >>> pPrintNoColor $ [1,2,3] -- [ 1 -- , 2 -- , 3@@ -66,14 +101,14 @@ -- -- Slightly more complicated lists: ----- >>> pPrint $ [ Foo [ (),    () ] "hello" ]+-- >>> pPrintNoColor $ [ Foo [ (),    () ] "hello" ] -- [ Foo --     [ () --     , () --     ] "hello" -- ] ----- >>> pPrint $ [ Foo [ "bar", "baz" ] "hello", Foo [] "bye" ]+-- >>> pPrintNoColor $ [ Foo [ "bar", "baz" ] "hello", Foo [] "bye" ] -- [ Foo --     [ "bar" --     , "baz"@@ -91,7 +126,7 @@ --   } deriving Show -- :} ----- >>> pPrint $ Bar 1 [10, 11] [Foo 1.1 "", Foo 2.2 "hello"]+-- >>> pPrintNoColor $ Bar 1 [10, 11] [Foo 1.1 "", Foo 2.2 "hello"] -- Bar --     { barInt = 1 --     , barA =@@ -108,7 +143,7 @@ -- -- >>> newtype Baz = Baz { unBaz :: [String] } deriving Show ----- >>> pPrint $ Baz ["hello", "bye"]+-- >>> pPrintNoColor $ Baz ["hello", "bye"] -- Baz --     { unBaz = --         [ "hello"