|
| Generics.Regular.Functions | | Portability | non-portable | | Stability | experimental | | Maintainer | generics@haskell.org |
|
|
|
|
|
| Description |
| Summary: Generic functionality for regular dataypes: mapM, flatten, zip,
equality, show, value generation and fold.
|
|
| Synopsis |
|
| Functor (fmap) | | | class GMap f where | | | | class CrushR f where | | crushr :: (a -> b -> b) -> b -> f a -> b |
| | | flatten :: CrushR f => f a -> [a] | | | class Zip f where | | fzipM :: Monad m => (a -> b -> m c) -> f a -> f b -> m (f c) |
| | | fzip :: (Zip f, Monad m) => (a -> b -> c) -> f a -> f b -> m (f c) | | | fzip' :: Zip f => (a -> b -> c) -> f a -> f b -> f c | | | geq :: (b ~ PF a, Regular a, CrushR b, Zip b) => a -> a -> Bool | | | class GShow f where | | | | gshow :: (Regular a, GShow (PF a)) => a -> ShowS | | | class LRBase a where | | | | class LR f where | | | | left :: (Regular a, LR (PF a)) => a | | | right :: (Regular a, LR (PF a)) => a | | | type family Alg f r :: * | | | type Algebra a r = Alg (PF a) r | | | class Fold f where | | | | fold :: (Regular a, Fold (PF a), Functor (PF a)) => Algebra a r -> a -> r | | | (&) :: a -> b -> (a, b) |
|
|
|
| Functorial map function
|
|
| Functor (fmap) |
|
| Monadic functorial map function
|
|
|
| The GMap class defines a monadic functorial map.
| | | Methods | | | Instances | |
|
|
| Crush right functions
|
|
|
| The CrushR class defines a right-associative crush on functorial values.
| | | Methods | | crushr :: (a -> b -> b) -> b -> f a -> b | Source |
|
| | Instances | |
|
|
|
| Flatten a structure by collecting all the elements present.
|
|
| Zip functions
|
|
|
| The Zip class defines a monadic zip on functorial values.
| | | Methods | | fzipM :: Monad m => (a -> b -> m c) -> f a -> f b -> m (f c) | Source |
|
| | Instances | |
|
|
| fzip :: (Zip f, Monad m) => (a -> b -> c) -> f a -> f b -> m (f c) | Source |
|
| Functorial zip with a non-monadic function, resulting in a monadic value.
|
|
| fzip' :: Zip f => (a -> b -> c) -> f a -> f b -> f c | Source |
|
| Partial functorial zip with a non-monadic function.
|
|
| Equality function
|
|
|
| Equality on values based on their structural representation.
|
|
| Show function
|
|
|
| The GShow class defines a show on values.
| | | Methods | | | Instances | |
|
|
|
|
| Functions for generating values that are different on top-level
|
|
|
| The LRBase class defines two functions, leftb and rightb, which
should produce different values.
| | | Methods | | | Instances | |
|
|
|
| The LR class defines two functions, leftf and rightf, which should
produce different functorial values.
| | | Methods | | | Instances | |
|
|
|
| Produces a value which should be different from the value returned by
right.
|
|
|
| Produces a value which should be different from the value returned by
left.
|
|
| Generic folding
|
|
| type family Alg f r :: * | Source |
|
|
|
|
|
| The class fold explains how to convert an algebra
Alg into a function from functor to result.
| | | Methods | | | Instances | |
|
|
|
| Fold with convenient algebras.
|
|
|
| For constructing algebras it is helpful to use this pairing combinator.
|
|
| Produced by Haddock version 2.4.2 |