cassette-0.2.0: A combinator library for simultaneously defining parsers and pretty printers.
Safe HaskellNone
LanguageHaskell2010

Text.Cassette.Lead

Synopsis

Documentation

type NullL s = forall r. K7 Tr r (s -> r) Source #

Nullary leads. Synonym to PP.

type UnL s a = forall r. K7 Tr (a -> r) (s -> r) Source #

Unary leads. A lead of type UnL s a projects/injects a component a from/into outer type s.

type BinL s a b = forall r. K7 Tr (a -> b -> r) (s -> r) Source #

Binary leads. A lead of type BinL s a b projects/injects components a, b from/into outer type s.

type TernL s a b c = forall r. K7 Tr (a -> b -> c -> r) (s -> r) Source #

Ternary leads. A lead of type TernL s a b c projects/injects components a, b, c from/into outer type s.

type QuaternL s a b c d = forall r. K7 Tr (a -> b -> c -> d -> r) (s -> r) Source #

Quaternary leads. A lead of type QuaternL s a b c d projects/injects components a, b, c, d from/into outer type s.

isoL :: Iso s s a a -> UnL s a Source #

Lift an isomorphism (see the lens library) to a lead.

prismL :: Prism s s a a -> UnL s a Source #

Lift a prism (see lens library) to a lead.

catanar :: BinL b a b -> BinL b b [a] Source #

Iterates a one step construction function (resp. deconstruction) function, i.e. a lead, thus obtaining a right fold (resp. unfold). The resulting lead is a catamorphism on one side and an anamorpism on the other, hence the name. The type of this function is the same as that of foldr, lifted to cassettes.

catanal :: BinL a a b -> BinL a a [b] Source #

Iterates a one step construction function (resp. deconstruction) function, i.e. a lead, thus obtaining a left fold (resp. unfold). The resulting lead is a catamorphism on one side and an anamorpism on the other, hence the name. The type of this function is the same as that of foldl, lifted to cassettes.

consL :: K7 Tr (a -> [a] -> r) ([a] -> r) Source #

(:) lead.

nilL :: forall a r. K7 Tr r ([a] -> r) Source #

'[]' lead.

justL :: K7 Tr (a -> r) (Maybe a -> r) Source #

Just lead.

nothingL :: forall a r. K7 Tr r (Maybe a -> r) Source #

Nothing lead.

unitL :: NullL () Source #

Construct/destruct the unit element.

pairL :: K7 Tr (a -> b -> r) ((a, b) -> r) Source #

Construct/destruct a pair.

tripleL :: K7 Tr (a -> b -> c -> r) ((a, b, c) -> r) Source #

Construct/destruct a 3-tuple.

quadrupleL :: K7 Tr (a -> b -> c -> d -> r) ((a, b, c, d) -> r) Source #

Construct/destruct a 4-tuple.