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

Portability | non-portable
Stability | experimental
Maintainer | generics@haskell.org
Safe Haskell | None

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

Methods

children :: a -> [a]Source

context :: a -> [a] -> aSource

descend :: (a -> a) -> a -> aSource

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

transform :: (a -> a) -> a -> aSource

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

Instances

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

# Derived functions

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

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

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

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

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

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

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

# Default definitions

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

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

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

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

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

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