Data.Generics.Twins

syb-0.7.2.4: Scrap Your Boilerplate

Copyright | (c) The University of Glasgow CWI 2001--2004
License | BSD-style (see the LICENSE file)
Maintainer | generics@haskell.org
Stability | experimental
Portability | non-portable (local universal quantification)
Safe Haskell | Safe-Inferred
Language | Haskell98

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 :: forall (m :: Type -> Type). 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)
- gcompare :: Data a => a -> a -> Ordering

# 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) #

gfoldl with accumulation

Since: 0.1.0.0

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

gmapT with accumulation

Since: 0.1.0.0

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

gmapM with accumulation

Since: 0.1.0.0

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

gmapQl with accumulation

Since: 0.1.0.0

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

gmapQr with accumulation

Since: 0.1.0.0

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

gmapQ with accumulation

Since: 0.1.0.0

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

Applicative version

Since: 0.2

# Mapping combinators for twin traversal

gzipWithT :: GenericQ GenericT -> GenericQ GenericT #

Twin map for transformation

Since: 0.1.0.0

gzipWithM :: forall (m :: Type -> Type). Monad m => GenericQ (GenericM m) -> GenericQ (GenericM m) #

Twin map for monadic transformation

Since: 0.1.0.0

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

Twin map for queries

Since: 0.1.0.0

# Typical twin traversals

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

Generic equality: an alternative to "deriving Eq"

Since: 0.1.0.0

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

Generic zip controlled by a function with type-specific branches

Since: 0.1.0.0

gcompare :: Data a => a -> a -> Ordering #

Generic comparison: an alternative to "deriving Ord"

Since: 0.5