regular-0.3.4.4: Generic programming library for regular datatypes.

Copyright(c) 2008 Universiteit Utrecht
LicenseBSD3
Maintainergenerics@haskell.org
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell98

Generics.Regular.Functions.Crush

Contents

Description

Summary: Generic crush.

Synopsis

Crush functions

class Crush f where Source

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

Methods

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

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

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

Flatten a structure by collecting all the elements present.

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

Flatten a structure by collecting all the elements present.

crushr :: Crush f => (a -> b -> b) -> b -> f a -> b Source

crushl :: Crush f => (a -> b -> b) -> b -> f a -> b Source