Generics.Deriving.Uniplate

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 #

Methods

children :: a -> [a] #

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

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

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

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

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

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

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

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

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

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

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

Instances

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

# Derived functions

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 #

# Default definitions

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 #

# Internal Uniplate class

class Uniplate' f b where #

Minimal complete definition

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

Methods

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

Instances

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