generic-deriving-1.11.2: 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 | Trustworthy
Language | Haskell2010

Generics.Deriving.Uniplate

Contents

- Generic Uniplate class
- Derived functions
- Default definitions
- Internal Uniplate class

Description

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

Synopsis

- class Uniplate a where
- 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
- class Uniplate' f b where

# Generic Uniplate class

class Uniplate a where Source #

Methods

children :: a -> [a] Source #

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

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

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

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

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

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

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

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

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

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

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

Instances

Uniplate Bool Source # |
Methods children :: Bool -> [Bool] Source # context :: Bool -> [Bool] -> Bool Source # descend :: (Bool -> Bool) -> Bool -> Bool Source # descendM :: Monad m => (Bool -> m Bool) -> Bool -> m Bool Source # transform :: (Bool -> Bool) -> Bool -> Bool Source # transformM :: Monad m => (Bool -> m Bool) -> Bool -> m Bool Source #
Uniplate Char Source # |
Methods children :: Char -> [Char] Source # context :: Char -> [Char] -> Char Source # descend :: (Char -> Char) -> Char -> Char Source # descendM :: Monad m => (Char -> m Char) -> Char -> m Char Source # transform :: (Char -> Char) -> Char -> Char Source # transformM :: Monad m => (Char -> m Char) -> Char -> m Char Source #
Uniplate Double Source # |
Methods children :: Double -> [Double] Source # context :: Double -> [Double] -> Double Source # descend :: (Double -> Double) -> Double -> Double Source # descendM :: Monad m => (Double -> m Double) -> Double -> m Double Source # transform :: (Double -> Double) -> Double -> Double Source # transformM :: Monad m => (Double -> m Double) -> Double -> m Double Source #
Uniplate Float Source # |
Methods children :: Float -> [Float] Source # context :: Float -> [Float] -> Float Source # descend :: (Float -> Float) -> Float -> Float Source # descendM :: Monad m => (Float -> m Float) -> Float -> m Float Source # transform :: (Float -> Float) -> Float -> Float Source # transformM :: Monad m => (Float -> m Float) -> Float -> m Float Source #
Uniplate Int Source # |
Methods children :: Int -> [Int] Source # context :: Int -> [Int] -> Int Source # descend :: (Int -> Int) -> Int -> Int Source # descendM :: Monad m => (Int -> m Int) -> Int -> m Int Source # transform :: (Int -> Int) -> Int -> Int Source # transformM :: Monad m => (Int -> m Int) -> Int -> m Int Source #
Uniplate () Source # |
Methods children :: () -> [()] Source # context :: () -> [()] -> () Source # descend :: (() -> ()) -> () -> () Source # descendM :: Monad m => (() -> m ()) -> () -> m () Source # transform :: (() -> ()) -> () -> () Source # transformM :: Monad m => (() -> m ()) -> () -> m () Source #
Uniplate [a] Source # |
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 #
Uniplate (Maybe a) Source # |
Methods children :: Maybe a -> [Maybe a] Source # context :: Maybe a -> [Maybe a] -> Maybe a Source # descend :: (Maybe a -> Maybe a) -> Maybe a -> Maybe a Source # descendM :: Monad m => (Maybe a -> m (Maybe a)) -> Maybe a -> m (Maybe a) Source # transform :: (Maybe a -> Maybe a) -> Maybe a -> Maybe a Source # transformM :: Monad m => (Maybe a -> m (Maybe a)) -> Maybe a -> m (Maybe a) Source #
Uniplate (Either a b) Source # |

Methods

children :: Either a b -> [Either a b] Source #

context :: Either a b -> [Either a b] -> Either a b Source #

descend :: (Either a b -> Either a b) -> Either a b -> Either a b Source #

descendM :: Monad m => (Either a b -> m (Either a b)) -> Either a b -> m (Either a b) Source #

transform :: (Either a b -> Either a b) -> Either a b -> Either a b Source #

transformM :: Monad m => (Either a b -> m (Either a b)) -> Either a b -> m (Either a b) Source #

Uniplate (b, c) Source # |
Methods children :: (b, c) -> [(b, c)] Source # context :: (b, c) -> [(b, c)] -> (b, c) Source # descend :: ((b, c) -> (b, c)) -> (b, c) -> (b, c) Source # descendM :: Monad m => ((b, c) -> m (b, c)) -> (b, c) -> m (b, c) Source # transform :: ((b, c) -> (b, c)) -> (b, c) -> (b, c) Source # transformM :: Monad m => ((b, c) -> m (b, c)) -> (b, c) -> m (b, c) Source #
Uniplate (b, c, d) Source # |

Methods

children :: (b, c, d) -> [(b, c, d)] Source #

context :: (b, c, d) -> [(b, c, d)] -> (b, c, d) Source #

descend :: ((b, c, d) -> (b, c, d)) -> (b, c, d) -> (b, c, d) Source #

descendM :: Monad m => ((b, c, d) -> m (b, c, d)) -> (b, c, d) -> m (b, c, d) Source #

transform :: ((b, c, d) -> (b, c, d)) -> (b, c, d) -> (b, c, d) Source #

transformM :: Monad m => ((b, c, d) -> m (b, c, d)) -> (b, c, d) -> m (b, c, d) Source #

Uniplate (b, c, d, e) Source # |

Methods

children :: (b, c, d, e) -> [(b, c, d, e)] Source #

context :: (b, c, d, e) -> [(b, c, d, e)] -> (b, c, d, e) Source #

descend :: ((b, c, d, e) -> (b, c, d, e)) -> (b, c, d, e) -> (b, c, d, e) Source #

descendM :: Monad m => ((b, c, d, e) -> m (b, c, d, e)) -> (b, c, d, e) -> m (b, c, d, e) Source #

transform :: ((b, c, d, e) -> (b, c, d, e)) -> (b, c, d, e) -> (b, c, d, e) Source #

transformM :: Monad m => ((b, c, d, e) -> m (b, c, d, e)) -> (b, c, d, e) -> m (b, c, d, e) Source #

Uniplate (b, c, d, e, f) Source # |

Methods

children :: (b, c, d, e, f) -> [(b, c, d, e, f)] Source #

context :: (b, c, d, e, f) -> [(b, c, d, e, f)] -> (b, c, d, e, f) Source #

descend :: ((b, c, d, e, f) -> (b, c, d, e, f)) -> (b, c, d, e, f) -> (b, c, d, e, f) Source #

descendM :: Monad m => ((b, c, d, e, f) -> m (b, c, d, e, f)) -> (b, c, d, e, f) -> m (b, c, d, e, f) Source #

transform :: ((b, c, d, e, f) -> (b, c, d, e, f)) -> (b, c, d, e, f) -> (b, c, d, e, f) Source #

transformM :: Monad m => ((b, c, d, e, f) -> m (b, c, d, e, f)) -> (b, c, d, e, f) -> m (b, c, d, e, f) Source #

Uniplate (b, c, d, e, f, g) Source # |

Methods

children :: (b, c, d, e, f, g) -> [(b, c, d, e, f, g)] Source #

context :: (b, c, d, e, f, g) -> [(b, c, d, e, f, g)] -> (b, c, d, e, f, g) Source #

descend :: ((b, c, d, e, f, g) -> (b, c, d, e, f, g)) -> (b, c, d, e, f, g) -> (b, c, d, e, f, g) Source #

descendM :: Monad m => ((b, c, d, e, f, g) -> m (b, c, d, e, f, g)) -> (b, c, d, e, f, g) -> m (b, c, d, e, f, g) Source #

transform :: ((b, c, d, e, f, g) -> (b, c, d, e, f, g)) -> (b, c, d, e, f, g) -> (b, c, d, e, f, g) Source #

transformM :: Monad m => ((b, c, d, e, f, g) -> m (b, c, d, e, f, g)) -> (b, c, d, e, f, g) -> m (b, c, d, e, f, g) Source #

Uniplate (b, c, d, e, f, g, h) Source # |

Methods

children :: (b, c, d, e, f, g, h) -> [(b, c, d, e, f, g, h)] Source #

context :: (b, c, d, e, f, g, h) -> [(b, c, d, e, f, g, h)] -> (b, c, d, e, f, g, h) Source #

descend :: ((b, c, d, e, f, g, h) -> (b, c, d, e, f, g, h)) -> (b, c, d, e, f, g, h) -> (b, c, d, e, f, g, h) Source #

descendM :: Monad m => ((b, c, d, e, f, g, h) -> m (b, c, d, e, f, g, h)) -> (b, c, d, e, f, g, h) -> m (b, c, d, e, f, g, h) Source #

transform :: ((b, c, d, e, f, g, h) -> (b, c, d, e, f, g, h)) -> (b, c, d, e, f, g, h) -> (b, c, d, e, f, g, h) Source #

transformM :: Monad m => ((b, c, d, e, f, g, h) -> m (b, c, d, e, f, g, h)) -> (b, c, d, e, f, g, h) -> m (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 #

# Internal Uniplate class

class Uniplate' f b where Source #

Minimal complete definition

children', descend', descendM', transform', transformM'

Methods

children' :: f a -> [b] Source #

descend' :: (b -> b) -> f a -> f a Source #

descendM' :: Monad m => (b -> m b) -> f a -> m (f a) Source #

transform' :: (b -> b) -> f a -> f a Source #

transformM' :: Monad m => (b -> m b) -> f a -> m (f a) Source #

Instances

Uniplate' * U1 a Source # |
Methods children' :: a a -> [b] Source # descend' :: (b -> b) -> a a -> a a Source # descendM' :: Monad m => (b -> m b) -> a a -> m (a a) Source # transform' :: (b -> b) -> a a -> a a Source # transformM' :: Monad m => (b -> m b) -> a a -> m (a a) Source #
Uniplate' * (K1 i a) b Source # |
Methods children' :: b a -> [b] Source # descend' :: (b -> b) -> b a -> b a Source # descendM' :: Monad m => (b -> m b) -> b a -> m (b a) Source # transform' :: (b -> b) -> b a -> b a Source # transformM' :: Monad m => (b -> m b) -> b a -> m (b a) Source #
Uniplate a => Uniplate' * (K1 i a) a Source # |
Methods children' :: a a -> [b] Source # descend' :: (b -> b) -> a a -> a a Source # descendM' :: Monad m => (b -> m b) -> a a -> m (a a) Source # transform' :: (b -> b) -> a a -> a a Source # transformM' :: Monad m => (b -> m b) -> a a -> m (a a) Source #
(Uniplate' * f b, Uniplate' * g b) => Uniplate' * ((:+:) f g) b Source # |
Methods children' :: b a -> [b] Source # descend' :: (b -> b) -> b a -> b a Source # descendM' :: Monad m => (b -> m b) -> b a -> m (b a) Source # transform' :: (b -> b) -> b a -> b a Source # transformM' :: Monad m => (b -> m b) -> b a -> m (b a) Source #
(Uniplate' * f b, Uniplate' * g b) => Uniplate' * ((:*:) f g) b Source # |
Methods children' :: b a -> [b] Source # descend' :: (b -> b) -> b a -> b a Source # descendM' :: Monad m => (b -> m b) -> b a -> m (b a) Source # transform' :: (b -> b) -> b a -> b a Source # transformM' :: Monad m => (b -> m b) -> b a -> m (b a) Source #
Uniplate' * f b => Uniplate' * (M1 i c f) b Source # |
Methods children' :: b a -> [b] Source # descend' :: (b -> b) -> b a -> b a Source # descendM' :: Monad m => (b -> m b) -> b a -> m (b a) Source # transform' :: (b -> b) -> b a -> b a Source # transformM' :: Monad m => (b -> m b) -> b a -> m (b a) Source #