generic-deriving-1.9.0: Generic programming library for generalised deriving.

Copyright | 2011-2012 Universiteit Utrecht, University of Oxford
License | BSD3
Maintainer | generics@haskell.org
Stability | experimental
Portability | non-portable
Safe Haskell | None
Language | Haskell98

Generics.Deriving.Uniplate

Contents

- Derived functions
- Default definitions

Description

Summary: Functions inspired by the Uniplate generic programming library, mostly implemented by Sean Leather.

Synopsis

- class Uniplate a where
  - children :: a -> [a]
  - context :: a -> [a] -> a
  - descend :: (a -> a) -> a -> a
  - descendM :: Monad m => (a -> m a) -> a -> m a
  - transform :: (a -> a) -> a -> a
  - transformM :: Monad m => (a -> m a) -> a -> m a
- uniplate :: Uniplate a => a -> ([a], [a] -> a)
- universe :: Uniplate a => a -> [a]
- rewrite :: Uniplate a => (a -> Maybe a) -> a -> a
- rewriteM :: (Monad m, Uniplate a) => (a -> m (Maybe a)) -> a -> m a
- contexts :: Uniplate a => a -> [(a, a -> a)]
- holes :: Uniplate a => a -> [(a, a -> a)]
- para :: Uniplate a => (a -> [r] -> r) -> a -> r
- childrendefault :: (Generic a, Uniplate' (Rep a) a) => a -> [a]
- contextdefault :: (Generic a, Context' (Rep a) a) => a -> [a] -> a
- descenddefault :: (Generic a, Uniplate' (Rep a) a) => (a -> a) -> a -> a
- descendMdefault :: (Generic a, Uniplate' (Rep a) a, Monad m) => (a -> m a) -> a -> m a
- transformdefault :: (Generic a, Uniplate' (Rep a) a) => (a -> a) -> a -> a
- transformMdefault :: (Generic a, Uniplate' (Rep a) a, Monad m) => (a -> m a) -> a -> m a

# Documentation

class Uniplate a where Source

Minimal complete definition

Nothing

Methods

children :: a -> [a] Source

context :: a -> [a] -> a Source

descend :: (a -> a) -> a -> a Source

descendM :: Monad m => (a -> m a) -> a -> m a Source

transform :: (a -> a) -> a -> a Source

transformM :: Monad m => (a -> m a) -> a -> m a Source

Instances

Uniplate Bool Source |
Uniplate Char Source |
Uniplate Double Source |
Uniplate Float Source |
Uniplate Int Source |
Uniplate () Source |
Uniplate [a] Source |
Uniplate (Maybe a) Source |
Uniplate (Either a b) Source |
Uniplate (b, c) Source |
Uniplate (b, c, d) Source |
Uniplate (b, c, d, e) Source |
Uniplate (b, c, d, e, f) Source |
Uniplate (b, c, d, e, f, g) Source |
Uniplate (b, c, d, e, f, g, h) Source |

# Derived functions

uniplate :: Uniplate a => a -> ([a], [a] -> a) Source

universe :: Uniplate a => a -> [a] Source

rewrite :: Uniplate a => (a -> Maybe a) -> a -> a Source

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

contexts :: Uniplate a => a -> [(a, a -> a)] Source

holes :: Uniplate a => a -> [(a, a -> a)] Source

para :: Uniplate a => (a -> [r] -> r) -> a -> r Source

# Default definitions

childrendefault :: (Generic a, Uniplate' (Rep a) a) => a -> [a] Source

contextdefault :: (Generic a, Context' (Rep a) a) => a -> [a] -> a Source

descenddefault :: (Generic a, Uniplate' (Rep a) a) => (a -> a) -> a -> a Source

descendMdefault :: (Generic a, Uniplate' (Rep a) a, Monad m) => (a -> m a) -> a -> m a Source

transformdefault :: (Generic a, Uniplate' (Rep a) a) => (a -> a) -> a -> a Source

transformMdefault :: (Generic a, Uniplate' (Rep a) a, Monad m) => (a -> m a) -> a -> m a Source