| Safe Haskell | Safe | 
|---|---|
| Language | Haskell98 | 
System.Console.Hawk.Representable
Description
Used by Hawk's runtime to format the output of a Hawk expression. You can use this from your user prelude if you want Hawk to print your custom datatypes in a console-friendly format.
- class Show a => ListAsRow a where- listRepr' :: ByteString -> [a] -> ByteString
 
- class Row a => ListAsRows a where- listRepr :: ByteString -> [a] -> [ByteString]
 
- class Show a => Row a where- repr' :: ByteString -> a -> ByteString
 
- class Show a => Rows a where- repr :: ByteString -> a -> [ByteString]
 
Documentation
class Show a => ListAsRow a where Source
A type that instantiate ListAsRow is a type that has a representation when is embedded inside a list
For example:
>>>mapM_ Data.ByteString.Lazy.Char8.putStrLn $ repr Data.ByteString.Lazy.Char8.empty "test"test
Minimal complete definition
Nothing
Methods
listRepr' :: ByteString -> [a] -> ByteString Source
Instances
class Row a => ListAsRows a where Source
A type that instantiate ListAsRows is a type that has a representation when is embedded inside a list
Note: we use this class for representing a list of chars as String
 instead of the standard list representation. Without this repr "test" would
 yield [t,e,s,r] instead of "test".
For example:
>>>mapM_ Data.ByteString.Lazy.Char8.putStrLn $ repr Data.ByteString.Lazy.Char8.empty "test"test
Minimal complete definition
Nothing
Methods
Arguments
| :: ByteString | column delimiter | 
| -> [a] | list of values to represent | 
| -> [ByteString] | 
Instances
class Show a => Row a where Source
A Row is something that can be expressed as a record. The output of repr' should be formatted such that it can be read and processed from the command line.
For example:
>>>putStrLn $ show [1,2,3,4][1,2,3,4]
>>>Data.ByteString.Lazy.Char8.putStrLn $ repr' (Data.ByteString.Lazy.Char8.pack " ") [1,2,3,4]1 2 3 4
Minimal complete definition
Nothing
Instances
| Row Bool Source | |
| Row Char Source | |
| Row Double Source | |
| Row Float Source | |
| Row Int Source | |
| Row Integer Source | |
| Row () Source | |
| Row ByteString Source | |
| ListAsRow a => Row [a] Source | |
| Row a => Row (Maybe a) Source | |
| ListAsRow a => Row (Set a) Source | |
| (Row a, Row b) => Row (a, b) Source | |
| (Row a, Row b) => Row (Map a b) Source | |
| (Row a, Row b, Row c) => Row (a, b, c) Source | |
| (Row a, Row b, Row c, Row d) => Row (a, b, c, d) Source | |
| (Row a, Row b, Row c, Row d, Row e) => Row (a, b, c, d, e) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f) => Row (a, b, c, d, e, f) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g) => Row (a, b, c, d, e, f, g) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => Row (a, b, c, d, e, f, g, h) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => Row (a, b, c, d, e, f, g, h, i) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => Row (a, b, c, d, e, f, g, h, i, l) Source | 
class Show a => Rows a where Source
A type that instantiate Rows is a type that can be represented as a list of rows, where typically a row is a line.
For example:
>>>mapM_ Data.ByteString.Lazy.Char8.putStrLn $ repr (Data.ByteString.Lazy.Char8.singleton '\n') [1,2,3,4]1 2 3 4
Minimal complete definition
Nothing
Methods
Arguments
| :: ByteString | rows delimiter | 
| -> a | value to represent | 
| -> [ByteString] | 
Return a representation of the given value as list of strings.
Instances
| Rows Bool Source | |
| Rows Char Source | |
| Rows Double Source | |
| Rows Float Source | |
| Rows Int Source | |
| Rows Integer Source | |
| Rows () Source | |
| Rows ByteString Source | |
| ListAsRows a => Rows [a] Source | |
| Rows a => Rows (Maybe a) Source | |
| ListAsRows a => Rows (Set a) Source | |
| (Row a, Row b) => Rows (a, b) Source | |
| (Row a, Row b) => Rows (Map a b) Source | |
| (Row a, Row b, Row c) => Rows (a, b, c) Source | |
| (Row a, Row b, Row c, Row d) => Rows (a, b, c, d) Source | |
| (Row a, Row b, Row c, Row d, Row e) => Rows (a, b, c, d, e) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f) => Rows (a, b, c, d, e, f) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g) => Rows (a, b, c, d, e, f, g) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => Rows (a, b, c, d, e, f, g, h) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => Rows (a, b, c, d, e, f, g, h, i) Source | |
| (Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => Rows (a, b, c, d, e, f, g, h, i, l) Source |