Copyright | 2011-2012 Universiteit Utrecht University of Oxford |
---|---|

License | BSD3 |

Maintainer | generics@haskell.org |

Stability | experimental |

Portability | non-portable |

Safe Haskell | Trustworthy |

Language | Haskell2010 |

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
- children' :: f a -> [b]
- descend' :: (b -> b) -> f a -> f a
- descendM' :: Monad m => (b -> m b) -> f a -> m (f a)
- transform' :: (b -> b) -> f a -> f a
- transformM' :: Monad m => (b -> m b) -> f a -> m (f a)

- class Context' f b where
- context' :: f a -> [b] -> f a

# Generic Uniplate class

class Uniplate a where Source #

Nothing

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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate | |

Uniplate () Source # | |

Defined in Generics.Deriving.Uniplate | |

Uniplate [a] Source # | |

Defined in Generics.Deriving.Uniplate | |

Uniplate (Maybe a) Source # | |

Defined in Generics.Deriving.Uniplate 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 # | |

(Generic a, Uniplate' (Rep a) a, Context' (Rep a) a) => Uniplate (Default a) Source # | |

Defined in Generics.Deriving.Default children :: Default a -> [Default a] Source # context :: Default a -> [Default a] -> Default a Source # descend :: (Default a -> Default a) -> Default a -> Default a Source # descendM :: Monad m => (Default a -> m (Default a)) -> Default a -> m (Default a) Source # transform :: (Default a -> Default a) -> Default a -> Default a Source # transformM :: Monad m => (Default a -> m (Default a)) -> Default a -> m (Default a) Source # | |

Uniplate (Either a b) Source # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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 # | |

Defined in Generics.Deriving.Uniplate 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

# Default definitions

# Internal Uniplate class

class Uniplate' f b where Source #

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 :: k -> Type) a Source # | |

Defined in Generics.Deriving.Uniplate | |

(Uniplate' f b, Uniplate' g b) => Uniplate' (f :*: g :: k -> Type) b Source # | |

Defined in Generics.Deriving.Uniplate children' :: (f :*: g) a -> [b] Source # descend' :: (b -> b) -> (f :*: g) a -> (f :*: g) a Source # descendM' :: Monad m => (b -> m b) -> (f :*: g) a -> m ((f :*: g) a) Source # transform' :: (b -> b) -> (f :*: g) a -> (f :*: g) a Source # transformM' :: Monad m => (b -> m b) -> (f :*: g) a -> m ((f :*: g) a) Source # | |

(Uniplate' f b, Uniplate' g b) => Uniplate' (f :+: g :: k -> Type) b Source # | |

Defined in Generics.Deriving.Uniplate children' :: (f :+: g) a -> [b] Source # descend' :: (b -> b) -> (f :+: g) a -> (f :+: g) a Source # descendM' :: Monad m => (b -> m b) -> (f :+: g) a -> m ((f :+: g) a) Source # transform' :: (b -> b) -> (f :+: g) a -> (f :+: g) a Source # transformM' :: Monad m => (b -> m b) -> (f :+: g) a -> m ((f :+: g) a) Source # | |

Uniplate' (K1 i a :: k -> Type) b Source # | |

Defined in Generics.Deriving.Uniplate | |

Uniplate a => Uniplate' (K1 i a :: k -> Type) a Source # | |

Defined in Generics.Deriving.Uniplate | |

Uniplate' f b => Uniplate' (M1 i c f :: k -> Type) b Source # | |

Defined in Generics.Deriving.Uniplate children' :: M1 i c f a -> [b] Source # descend' :: (b -> b) -> M1 i c f a -> M1 i c f a Source # descendM' :: Monad m => (b -> m b) -> M1 i c f a -> m (M1 i c f a) Source # transform' :: (b -> b) -> M1 i c f a -> M1 i c f a Source # transformM' :: Monad m => (b -> m b) -> M1 i c f a -> m (M1 i c f a) Source # |

# Internal Context class

class Context' f b where Source #

## Instances

Context' (U1 :: k -> Type) b Source # | |

Context' g b => Context' (f :*: g :: k -> Type) b Source # | |

Context' g a => Context' (M1 i c (K1 j a :: k -> Type) :*: g :: k -> Type) a Source # | |

(Context' f b, Context' g b) => Context' (f :+: g :: k -> Type) b Source # | |

Context' (K1 i a :: k -> Type) b Source # | |

Context' (K1 i a :: k -> Type) a Source # | |

Context' f b => Context' (M1 i c f :: k -> Type) b Source # | |