| Copyright | (c) Dennis Gosnell 2016 |
|---|---|
| License | BSD-style (see LICENSE file) |
| Maintainer | [email protected] |
| Stability | experimental |
| Portability | POSIX |
| Safe Haskell | None |
| Language | Haskell2010 |
Text.Pretty.Simple
Description
- pShow :: Show a => a -> Text
- pPrint :: (MonadIO m, Show a) => a -> m ()
- pString :: String -> Text
- pShowNoColor :: Show a => a -> Text
- pPrintNoColor :: (MonadIO m, Show a) => a -> m ()
- pStringNoColor :: String -> Text
- pShowOpt :: Show a => OutputOptions -> a -> Text
- pPrintOpt :: (MonadIO m, Show a) => OutputOptions -> a -> m ()
- pStringOpt :: OutputOptions -> String -> Text
- data OutputOptions = OutputOptions {}
- data UseColor
- defaultOutputOptions :: OutputOptions
- noColorOutputOptions :: OutputOptions
Output With Color
Output With NO Color
pShowNoColor :: Show a => a -> Text Source #
pPrintNoColor :: (MonadIO m, Show a) => a -> m () Source #
pStringNoColor :: String -> Text Source #
Output With Output Options
pStringOpt :: OutputOptions -> String -> Text Source #
data OutputOptions Source #
Data-type wrapping up all the options available when rendering the list
of Outputs.
Constructors
| OutputOptions | |
Fields
| |
Instances
defaultOutputOptions :: OutputOptions Source #
Default values for OutputOptions. _indentAmount defaults to 4, and
_useColor defaults to UseColor.
Examples
Simple Haskell datatype:
>>>data Foo a = Foo a String deriving Show
>>>pPrintNoColor $ Foo 3 "hello"Foo 3 "hello"
Lists:
>>>pPrintNoColor $ [1,2,3][ 1 , 2 , 3 ]
Slightly more complicated lists:
>>>pPrintNoColor $ [ Foo [ (), () ] "hello" ][ Foo [ () , () ] "hello" ]
>>>pPrintNoColor $ [ Foo [ "bar", "baz" ] "hello", Foo [] "bye" ][ Foo [ "bar" , "baz" ] "hello" , Foo [] "bye" ]
Record:
>>>:{data Bar b = Bar { barInt :: Int , barA :: b , barList :: [Foo Double] } deriving Show :}
>>>pPrintNoColor $ Bar 1 [10, 11] [Foo 1.1 "", Foo 2.2 "hello"]Bar { barInt = 1 , barA = [ 10 , 11 ] , barList = [ Foo 1.1 "" , Foo 2.2 "hello" ] }
Newtype:
>>>newtype Baz = Baz { unBaz :: [String] } deriving Show
>>>pPrintNoColor $ Baz ["hello", "bye"]Baz { unBaz = [ "hello" , "bye" ] }