sifflet-lib-1.2.4: Library of modules shared by sifflet and its tests and its exporters.

Sifflet.Text.Repr

Synopsis

Documentation

class Repr a whereSource

class Repr: representable by a String or a list of Strings

repr x is a String representation of x. reprl x is a [String] representation of x, where the first element should be the same as repr x, and the rest provide auxiliary information that you want to be shown with x. reprs x is a reduction of reprl x to a single String. reprList prefix infix postfix xs is the representation of a list of xs

Minimal complete implementation: define repr, or define reprl. The normal way is to define repr. Define reprl instead, if for some reason you want to include additional information such as the value of an expression in an expression node.

Examples: - (3 :: Int) has repr => 3, reprl => [3], reprs => 3 - In Sifflet.Language.Expr, (ENode (NSymbol x) (EvalOk (3 :: Int) has reprl => [x, 3], reprs => x 3, and repr => x. - reprList ( ) [3 :: Int, 4, 5] => (3 4 5)

Methods

repr :: a -> StringSource

reprl :: a -> [String]Source

reprs :: a -> StringSource

reprList :: String -> String -> String -> [a] -> StringSource

data Name Source

Constructors

Name String 

Instances