haskell-awk-1.2: Transform text from the command-line using Haskell expressions.
Safe HaskellSafe-Inferred
LanguageHaskell2010

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.

Synopsis

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

Instances details
ListAsRow Bool Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow Char Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow Double Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow Float Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow Int Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow Integer Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow () Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [()] -> ByteString Source #

ListAsRow ByteString Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow a => ListAsRow [a] Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [[a]] -> ByteString Source #

Row a => ListAsRow (Maybe a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow a => ListAsRow (Set a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

(Row a, Row b) => ListAsRow (a, b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b)] -> ByteString Source #

(Row a, Row b) => ListAsRow (Map a b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [Map a b] -> ByteString Source #

(Row a, Row b, Row c) => ListAsRow (a, b, c) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c)] -> ByteString Source #

(Row a, Row b, Row c, Row d) => ListAsRow (a, b, c, d) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c, d)] -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e) => ListAsRow (a, b, c, d, e) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c, d, e)] -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e, Row f) => ListAsRow (a, b, c, d, e, f) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c, d, e, f)] -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g) => ListAsRow (a, b, c, d, e, f, g) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c, d, e, f, g)] -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => ListAsRow (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c, d, e, f, g, h)] -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => ListAsRow (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c, d, e, f, g, h, i)] -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => ListAsRow (a, b, c, d, e, f, g, h, i, l) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr' :: ByteString -> [(a, b, c, d, e, f, g, h, i, l)] -> ByteString Source #

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

listRepr Source #

Arguments

:: ByteString

column delimiter

-> [a]

list of values to represent

-> [ByteString] 

Instances

Instances details
ListAsRows Bool Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRows Char Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRows Double Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRows Float Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRows Int Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRows Integer Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRows () Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [()] -> [ByteString] Source #

ListAsRows ByteString Source # 
Instance details

Defined in System.Console.Hawk.Representable

(ListAsRow a, ListAsRows a) => ListAsRows [a] Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [[a]] -> [ByteString] Source #

Row a => ListAsRows (Maybe a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [Maybe a] -> [ByteString] Source #

(ListAsRow a, ListAsRows a) => ListAsRows (Set a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [Set a] -> [ByteString] Source #

(Row a, Row b) => ListAsRows (a, b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b)] -> [ByteString] Source #

(Row a, Row b) => ListAsRows (Map a b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [Map a b] -> [ByteString] Source #

(Row a, Row b, Row c) => ListAsRows (a, b, c) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c)] -> [ByteString] Source #

(Row a, Row b, Row c, Row d) => ListAsRows (a, b, c, d) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c, d)] -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e) => ListAsRows (a, b, c, d, e) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c, d, e)] -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e, Row f) => ListAsRows (a, b, c, d, e, f) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c, d, e, f)] -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g) => ListAsRows (a, b, c, d, e, f, g) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c, d, e, f, g)] -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h) => ListAsRows (a, b, c, d, e, f, g, h) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c, d, e, f, g, h)] -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i) => ListAsRows (a, b, c, d, e, f, g, h, i) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c, d, e, f, g, h, i)] -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g, Row h, Row i, Row l) => ListAsRows (a, b, c, d, e, f, g, h, i, l) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

listRepr :: ByteString -> [(a, b, c, d, e, f, g, h, i, l)] -> [ByteString] Source #

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

Methods

repr' Source #

Arguments

:: ByteString

columns delimiter

-> a

value to represent

-> ByteString 

Instances

Instances details
Row Bool Source # 
Instance details

Defined in System.Console.Hawk.Representable

Row Char Source # 
Instance details

Defined in System.Console.Hawk.Representable

Row Double Source # 
Instance details

Defined in System.Console.Hawk.Representable

Row Float Source # 
Instance details

Defined in System.Console.Hawk.Representable

Row Int Source # 
Instance details

Defined in System.Console.Hawk.Representable

Row Integer Source # 
Instance details

Defined in System.Console.Hawk.Representable

Row () Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> () -> ByteString Source #

Row ByteString Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow a => Row [a] Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> [a] -> ByteString Source #

Row a => Row (Maybe a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRow a => Row (Set a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

(Row a, Row b) => Row (a, b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b) -> ByteString Source #

(Row a, Row b) => Row (Map a b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> Map a b -> ByteString Source #

(Row a, Row b, Row c) => Row (a, b, c) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c) -> ByteString Source #

(Row a, Row b, Row c, Row d) => Row (a, b, c, d) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c, d) -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e) => Row (a, b, c, d, e) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c, d, e) -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e, Row f) => Row (a, b, c, d, e, f) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c, d, e, f) -> ByteString Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g) => Row (a, b, c, d, e, f, g) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c, d, e, f, g) -> ByteString 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 # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c, d, e, f, g, h) -> ByteString 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 # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c, d, e, f, g, h, i) -> ByteString 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 # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr' :: ByteString -> (a, b, c, d, e, f, g, h, i, l) -> ByteString 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

repr Source #

Arguments

:: ByteString

rows delimiter

-> a

value to represent

-> [ByteString] 

Return a representation of the given value as list of strings.

Instances

Instances details
Rows Bool Source # 
Instance details

Defined in System.Console.Hawk.Representable

Rows Char Source # 
Instance details

Defined in System.Console.Hawk.Representable

Rows Double Source # 
Instance details

Defined in System.Console.Hawk.Representable

Rows Float Source # 
Instance details

Defined in System.Console.Hawk.Representable

Rows Int Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> Int -> [ByteString] Source #

Rows Integer Source # 
Instance details

Defined in System.Console.Hawk.Representable

Rows () Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> () -> [ByteString] Source #

Rows ByteString Source # 
Instance details

Defined in System.Console.Hawk.Representable

ListAsRows a => Rows [a] Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> [a] -> [ByteString] Source #

Rows a => Rows (Maybe a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> Maybe a -> [ByteString] Source #

ListAsRows a => Rows (Set a) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> Set a -> [ByteString] Source #

(Row a, Row b) => Rows (a, b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b) -> [ByteString] Source #

(Row a, Row b) => Rows (Map a b) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> Map a b -> [ByteString] Source #

(Row a, Row b, Row c) => Rows (a, b, c) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c) -> [ByteString] Source #

(Row a, Row b, Row c, Row d) => Rows (a, b, c, d) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c, d) -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e) => Rows (a, b, c, d, e) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c, d, e) -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e, Row f) => Rows (a, b, c, d, e, f) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c, d, e, f) -> [ByteString] Source #

(Row a, Row b, Row c, Row d, Row e, Row f, Row g) => Rows (a, b, c, d, e, f, g) Source # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c, d, e, f, g) -> [ByteString] 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 # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c, d, e, f, g, h) -> [ByteString] 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 # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c, d, e, f, g, h, i) -> [ByteString] 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 # 
Instance details

Defined in System.Console.Hawk.Representable

Methods

repr :: ByteString -> (a, b, c, d, e, f, g, h, i, l) -> [ByteString] Source #