regular-0.3.4: Generic programming library for regular datatypes.

Portabilitynon-portable
Stabilityexperimental
Maintainergenerics@haskell.org

Generics.Regular.Functions.Crush

Contents

Description

Summary: Generic crush.

Synopsis

Crush functions

class Crush f whereSource

The Crush class defines a right-associative crush on functorial values.

Methods

crush :: Assoc -> (a -> b -> b) -> b -> f a -> bSource

Instances

Crush U 
Crush I 
Crush (K a) 
Crush f => Crush (S s f) 
Crush f => Crush (C c f) 
(Crush f, Crush g) => Crush (:*: f g) 
(Crush f, Crush g) => Crush (:+: f g) 

data Assoc Source

Associativity of the binary operator used for crush

Constructors

AssocLeft

Left-associative

AssocRight

Right-associative

flattenr, flattenl :: Crush f => f a -> [a]Source

Flatten a structure by collecting all the elements present.

crushr, crushl :: Crush f => (a -> b -> b) -> b -> f a -> bSource