generic-deriving-1.13.1: 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 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 #

Minimal complete definition

Nothing

Methods

children :: a -> [a] Source #

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

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

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

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

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

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

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

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

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

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

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

#### Instances

Instances details

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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 #

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

Instance details

Defined in Generics.Deriving.Default

Methods

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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

Instance details

Defined in Generics.Deriving.Uniplate

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 #

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

Instances details

Uniplate' (U1 :: k -> Type) a Source # |

Instance details

Defined in Generics.Deriving.Uniplate

Methods

children' :: forall (a0 :: k0). U1 a0 -> [a] Source #

descend' :: forall (a0 :: k0). (a -> a) -> U1 a0 -> U1 a0 Source #

descendM' :: forall m (a0 :: k0). Monad m => (a -> m a) -> U1 a0 -> m (U1 a0) Source #

transform' :: forall (a0 :: k0). (a -> a) -> U1 a0 -> U1 a0 Source #

transformM' :: forall m (a0 :: k0). Monad m => (a -> m a) -> U1 a0 -> m (U1 a0) Source #

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

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

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

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

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

transformM' :: forall m (a :: k0). 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 # |

Instance details

Defined in Generics.Deriving.Uniplate

Methods

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

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

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

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

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

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

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

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

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

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

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

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

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

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

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

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

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

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

Instance details

Defined in Generics.Deriving.Uniplate

Methods

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

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

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

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

transformM' :: forall m (a :: k0). 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 #

Methods

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

#### Instances

Instances details

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