cassette-0.1.0: A combinator library for simultaneously defining parsers and pretty printers.

Safe HaskellSafe-Infered

Text.Cassette.Lead

Synopsis

Documentation

type UnL a b = forall r r'. K7 (C (b -> r)) (C (a -> r)) (C (b -> r')) (C (a -> r'))Source

The type of binary leads, parameterized by the type of the left operand, the right operand, and the type of the result.

type BinL a b c = forall r r'. K7 (C (c -> r)) (C (b -> a -> r)) (C (c -> r')) (C (b -> a -> r'))Source

The type of binary leads, parameterized by the type of the left operand, the right operand, and the type of the result.

liftL :: Sym a b -> UnL a bSource

Lift a pair of symmetric functions to a lead.

catanar :: BinL a b b -> BinL b [a] bSource

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 b a -> BinL a [b] aSource

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 :: BinL a [a] [a]Source

nilL :: PP [a]Source

pairL :: BinL a b (a, b)Source

tripleL :: K7 (C ((a, b, c) -> r)) (C (c -> b -> a -> r)) (C ((a, b, c) -> r')) (C (c -> b -> a -> r'))Source

quadrupleL :: K7 (C ((a, b, c, d) -> r)) (C (d -> c -> b -> a -> r)) (C ((a, b, c, d) -> r')) (C (d -> c -> b -> a -> r'))Source