generic-deriving-1.14.6: 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
- Internal Context class

Description

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
- class Uniplate' (f :: k -> Type) b where
  - children' :: forall (a :: k). f a -> [b]
  - descend' :: forall (a :: k). (b -> b) -> f a -> f a
  - descendM' :: forall m (a :: k). Monad m => (b -> m b) -> f a -> m (f a)
  - transform' :: forall (a :: k). (b -> b) -> f a -> f a
  - transformM' :: forall m (a :: k). Monad m => (b -> m b) -> f a -> m (f a)
- class Context' (f :: k -> Type) b where
  - context' :: forall (a :: k). f a -> [b] -> f a

# Generic Uniplate class

class Uniplate a where #

Minimal complete definition

Nothing

Methods

children :: a -> [a] #

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

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

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

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

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

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

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

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

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

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

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

#### Instances

Instances details

Uniplate () # |
Instance details Defined in Generics.Deriving.Uniplate Methods children :: () -> [()] # context :: () -> [()] -> () # descend :: (() -> ()) -> () -> () # descendM :: Monad m => (() -> m ()) -> () -> m () # transform :: (() -> ()) -> () -> () # transformM :: Monad m => (() -> m ()) -> () -> m () #
Uniplate Bool # |
Instance details Defined in Generics.Deriving.Uniplate 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 # |
Instance details Defined in Generics.Deriving.Uniplate 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 # |
Instance details Defined in Generics.Deriving.Uniplate 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 # |
Instance details Defined in Generics.Deriving.Uniplate 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 # |
Instance details Defined in Generics.Deriving.Uniplate 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 #
(Generic a, Uniplate' (Rep a) a, Context' (Rep a) a) => Uniplate (Default a) # |

Instance details

Defined in Generics.Deriving.Default

Methods

children :: Default a -> [Default a] #

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

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

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

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

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

Uniplate (Maybe a) # |

Instance details

Defined in Generics.Deriving.Uniplate

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 [a] # |
Instance details Defined in Generics.Deriving.Uniplate 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 (Either a b) # |

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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 :: k -> Type) b where #

Methods

children' :: forall (a :: k). f a -> [b] #

descend' :: forall (a :: k). (b -> b) -> f a -> f a #

descendM' :: forall m (a :: k). Monad m => (b -> m b) -> f a -> m (f a) #

transform' :: forall (a :: k). (b -> b) -> f a -> f a #

transformM' :: forall m (a :: k). Monad m => (b -> m b) -> f a -> m (f a) #

#### Instances

Instances details

Uniplate' (U1 :: k -> Type) a # |
Instance details Defined in Generics.Deriving.Uniplate Methods children' :: forall (a0 :: k). U1 a0 -> [a] # descend' :: forall (a0 :: k). (a -> a) -> U1 a0 -> U1 a0 # descendM' :: forall m (a0 :: k). Monad m => (a -> m a) -> U1 a0 -> m (U1 a0) # transform' :: forall (a0 :: k). (a -> a) -> U1 a0 -> U1 a0 # transformM' :: forall m (a0 :: k). Monad m => (a -> m a) -> U1 a0 -> m (U1 a0) #
(Uniplate' f b, Uniplate' g b) => Uniplate' (f :*: g :: k -> Type) b # |

Instance details

Defined in Generics.Deriving.Uniplate

Methods

children' :: forall (a :: k). (f :*: g) a -> [b] #

descend' :: forall (a :: k). (b -> b) -> (f :*: g) a -> (f :*: g) a #

descendM' :: forall m (a :: k). Monad m => (b -> m b) -> (f :*: g) a -> m ((f :*: g) a) #

transform' :: forall (a :: k). (b -> b) -> (f :*: g) a -> (f :*: g) a #

transformM' :: forall m (a :: k). Monad m => (b -> m b) -> (f :*: g) a -> m ((f :*: g) a) #

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

children' :: forall (a :: k). (f :+: g) a -> [b] #

descend' :: forall (a :: k). (b -> b) -> (f :+: g) a -> (f :+: g) a #

descendM' :: forall m (a :: k). Monad m => (b -> m b) -> (f :+: g) a -> m ((f :+: g) a) #

transform' :: forall (a :: k). (b -> b) -> (f :+: g) a -> (f :+: g) a #

transformM' :: forall m (a :: k). Monad m => (b -> m b) -> (f :+: g) a -> m ((f :+: g) a) #

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

children' :: forall (a0 :: k). K1 i a a0 -> [a] #

descend' :: forall (a0 :: k). (a -> a) -> K1 i a a0 -> K1 i a a0 #

descendM' :: forall m (a0 :: k). Monad m => (a -> m a) -> K1 i a a0 -> m (K1 i a a0) #

transform' :: forall (a0 :: k). (a -> a) -> K1 i a a0 -> K1 i a a0 #

transformM' :: forall m (a0 :: k). Monad m => (a -> m a) -> K1 i a a0 -> m (K1 i a a0) #

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

children' :: forall (a0 :: k). K1 i a a0 -> [b] #

descend' :: forall (a0 :: k). (b -> b) -> K1 i a a0 -> K1 i a a0 #

descendM' :: forall m (a0 :: k). Monad m => (b -> m b) -> K1 i a a0 -> m (K1 i a a0) #

transform' :: forall (a0 :: k). (b -> b) -> K1 i a a0 -> K1 i a a0 #

transformM' :: forall m (a0 :: k). Monad m => (b -> m b) -> K1 i a a0 -> m (K1 i a a0) #

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

children' :: forall (a :: k). M1 i c f a -> [b] #

descend' :: forall (a :: k). (b -> b) -> M1 i c f a -> M1 i c f a #

descendM' :: forall m (a :: k). Monad m => (b -> m b) -> M1 i c f a -> m (M1 i c f a) #

transform' :: forall (a :: k). (b -> b) -> M1 i c f a -> M1 i c f a #

transformM' :: forall m (a :: k). Monad m => (b -> m b) -> M1 i c f a -> m (M1 i c f a) #

# Internal Context class

class Context' (f :: k -> Type) b where #

Methods

context' :: forall (a :: k). f a -> [b] -> f a #

#### Instances

Instances details

Context' (U1 :: k -> Type) b # |
Instance details Defined in Generics.Deriving.Uniplate Methods context' :: forall (a :: k). U1 a -> [b] -> U1 a #
Context' g a => Context' (M1 i c (K1 j a :: k -> Type) :*: g :: k -> Type) a # |
Instance details Defined in Generics.Deriving.Uniplate Methods context' :: forall (a0 :: k). (M1 i c (K1 j a :: k -> Type) :*: g) a0 -> [a] -> (M1 i c (K1 j a :: k -> Type) :*: g) a0 #
Context' g b => Context' (f :*: g :: k -> Type) b # |
Instance details Defined in Generics.Deriving.Uniplate Methods context' :: forall (a :: k). (f :*: g) a -> [b] -> (f :*: g) a #
(Context' f b, Context' g b) => Context' (f :+: g :: k -> Type) b # |
Instance details Defined in Generics.Deriving.Uniplate Methods context' :: forall (a :: k). (f :+: g) a -> [b] -> (f :+: g) a #
Context' (K1 i a :: k -> Type) a # |
Instance details Defined in Generics.Deriving.Uniplate Methods context' :: forall (a0 :: k). K1 i a a0 -> [a] -> K1 i a a0 #
Context' (K1 i a :: k -> Type) b # |
Instance details Defined in Generics.Deriving.Uniplate Methods context' :: forall (a0 :: k). K1 i a a0 -> [b] -> K1 i a a0 #
Context' f b => Context' (M1 i c f :: k -> Type) b # |
Instance details Defined in Generics.Deriving.Uniplate Methods context' :: forall (a :: k). M1 i c f a -> [b] -> M1 i c f a #