Copyright | (C) 2016 Justin Sermeno |
---|---|
License | BSD3 |
Maintainer | Justin Sermeno |
Safe Haskell | Safe |
Language | Haskell2010 |
An instance Display
is similar to an instance of Show
. The difference is that -- Show
is meant to return well-formed haskell expressions and a complementary
Read
instance should be possible. Display
is meant for human-readable output.
For instance, you could have a complex data structure output a chart by default
in GHCi, while still being able to derive an instance of Show
to inspect the
data structure when needed.
- class Display a where
- data DisplayText
- mkDisplayText :: Text -> DisplayText
- unDisplayText :: DisplayText -> Text
- mkDt :: Text -> DisplayText
- unDt :: DisplayText -> Text
- mkDisplayTextStr :: String -> DisplayText
- unDisplayTextStr :: DisplayText -> String
- mkDtStr :: String -> DisplayText
- unDtStr :: DisplayText -> String
- dShow :: Display a => a -> Text
- dPrint :: Display a => a -> IO ()
- ppShow :: Show a => a -> String
- pPrint :: Show a => a -> IO ()
Types
data DisplayText Source #
Converting to the DisplayText
type
mkDisplayText :: Text -> DisplayText Source #
Wrap Text
into a DisplayText
.
unDisplayText :: DisplayText -> Text Source #
Unwrap DisplayText
to a Text
.
unDt :: DisplayText -> Text Source #
Alias for unDisplayText
mkDisplayTextStr :: String -> DisplayText Source #
Wrap String
into a DisplayText
.
unDisplayTextStr :: DisplayText -> String Source #
Unwrap DisplayText
to a String
.
mkDtStr :: String -> DisplayText Source #
Alias for mkDisplayTextStr
unDtStr :: DisplayText -> String Source #
Alias for unDisplayTextStr