uniplate-1.6.12: Help writing simple, concise and fast generic operations.

Safe Haskell | None
Language | Haskell98

Data.Generics.Compos

Description

Compos compatibility layer. This module serves as a drop-in replacement in some situations for some of the Compos operations. Only the single-type traversals are supported, on normal algebraic data types. Users should also import either Data.Generics.Uniplate.Data or Data.Generics.Uniplate.Direct.

Compos is described in the paper: "A Pattern for Almost Compositional Functions" by Bjorn Bringert and Aarne Ranta.

- http://doi.acm.org/10.1145/1159803.1159834
- http://www.cs.chalmers.se/~bringert/publ/composOp/composOp.pdf

Synopsis

- class Uniplate a => Compos a
- composOp :: Uniplate a => (a -> a) -> a -> a
- composOpM :: (Uniplate a, Monad m) => (a -> m a) -> a -> m a
- composOpM_ :: (Uniplate a, Monad m) => (a -> m ()) -> a -> m ()
- composOpMonoid :: (Uniplate a, Monoid m) => (a -> m) -> a -> m
- composOpMPlus :: (Uniplate a, MonadPlus m) => (a -> m b) -> a -> m b
- composOpFold :: Uniplate a => b -> (b -> b -> b) -> (a -> b) -> a -> b

# Documentation

class Uniplate a => Compos a Source

If you want to keep an existing type class

composOp :: Uniplate a => (a -> a) -> a -> a Source

    composOp == descend

composOpM :: (Uniplate a, Monad m) => (a -> m a) -> a -> m a Source

    composOpM == descendM

composOpM_ :: (Uniplate a, Monad m) => (a -> m ()) -> a -> m () Source

    composOpM_ == composOpFold (return ()) (>>)

composOpMonoid :: (Uniplate a, Monoid m) => (a -> m) -> a -> m Source

    composOpMonoid = composOpFold mempty mappend

composOpMPlus :: (Uniplate a, MonadPlus m) => (a -> m b) -> a -> m b Source

    composOpMPlus = composOpFold mzero mplus

composOpFold :: Uniplate a => b -> (b -> b -> b) -> (a -> b) -> a -> b Source

Probably replace with `universe`, perhaps `para`