syb-0.4.0: Scrap Your Boilerplate

Portability | non-portable (local universal quantification)
Stability | experimental
Maintainer | generics@haskell.org
Safe Haskell | Safe-Inferred

Data.Generics.Twins

Contents

- Generic folds and maps that also accumulate
- Mapping combinators for twin traversal
- Typical twin traversals

Description

"Scrap your boilerplate" --- Generic programming in Haskell See http://www.cs.uu.nl/wiki/GenericProgramming/SYB. The present module provides support for multi-parameter traversal, which is also demonstrated with generic operations like equality.

Synopsis

- gfoldlAccum :: Data d => (forall e r. Data e => a -> c (e -> r) -> e -> (a, c r)) -> (forall g. a -> g -> (a, c g)) -> a -> d -> (a, c d)
- gmapAccumT :: Data d => (forall e. Data e => a -> e -> (a, e)) -> a -> d -> (a, d)
- gmapAccumM :: (Data d, Monad m) => (forall e. Data e => a -> e -> (a, m e)) -> a -> d -> (a, m d)
- gmapAccumQl :: Data d => (r -> r' -> r) -> r -> (forall e. Data e => a -> e -> (a, r')) -> a -> d -> (a, r)
- gmapAccumQr :: Data d => (r' -> r -> r) -> r -> (forall e. Data e => a -> e -> (a, r')) -> a -> d -> (a, r)
- gmapAccumQ :: Data d => (forall e. Data e => a -> e -> (a, q)) -> a -> d -> (a, [q])
- gmapAccumA :: forall b d a. (Data d, Applicative a) => (forall e. Data e => b -> e -> (b, a e)) -> b -> d -> (b, a d)
- gzipWithT :: GenericQ GenericT -> GenericQ GenericT
- gzipWithM :: Monad m => GenericQ (GenericM m) -> GenericQ (GenericM m)
- gzipWithQ :: GenericQ (GenericQ r) -> GenericQ (GenericQ [r])
- geq :: Data a => a -> a -> Bool
- gzip :: GenericQ (GenericM Maybe) -> GenericQ (GenericM Maybe)

# Generic folds and maps that also accumulate

gfoldlAccum :: Data d => (forall e r. Data e => a -> c (e -> r) -> e -> (a, c r)) -> (forall g. a -> g -> (a, c g)) -> a -> d -> (a, c d)Source

gfoldl with accumulation

gmapAccumT :: Data d => (forall e. Data e => a -> e -> (a, e)) -> a -> d -> (a, d)Source

gmapT with accumulation

gmapAccumM :: (Data d, Monad m) => (forall e. Data e => a -> e -> (a, m e)) -> a -> d -> (a, m d)Source

gmapM with accumulation

gmapAccumQl :: Data d => (r -> r' -> r) -> r -> (forall e. Data e => a -> e -> (a, r')) -> a -> d -> (a, r)Source

gmapQl with accumulation

gmapAccumQr :: Data d => (r' -> r -> r) -> r -> (forall e. Data e => a -> e -> (a, r')) -> a -> d -> (a, r)Source

gmapQr with accumulation

gmapAccumQ :: Data d => (forall e. Data e => a -> e -> (a, q)) -> a -> d -> (a, [q])Source

gmapQ with accumulation

gmapAccumA :: forall b d a. (Data d, Applicative a) => (forall e. Data e => b -> e -> (b, a e)) -> b -> d -> (b, a d)Source

Applicative version

# Mapping combinators for twin traversal

gzipWithT :: GenericQ GenericT -> GenericQ GenericT Source

Twin map for transformation

gzipWithM :: Monad m => GenericQ (GenericM m) -> GenericQ (GenericM m)Source

Twin map for monadic transformation

gzipWithQ :: GenericQ (GenericQ r) -> GenericQ (GenericQ [r])Source

Twin map for queries

# Typical twin traversals

geq :: Data a => a -> a -> Bool Source

Generic equality: an alternative to "deriving Eq"

gzip :: GenericQ (GenericM Maybe) -> GenericQ (GenericM Maybe)Source

Generic zip controlled by a function with type-specific branches