-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Generic programming library for generalized deriving.
--
-- This package provides functionality for generalizing the deriving
-- mechanism in Haskell to arbitrary classes. It was first described in
-- the paper:
--
--
-- - A generic deriving mechanism for Haskell. Jose Pedro
-- Magalhaes, Atze Dijkstra, Johan Jeuring, and Andres Loeh.
-- Haskell'10.
--
--
-- The current implementation integrates with the new GHC Generics. See
-- http://www.haskell.org/haskellwiki/Generics for more
-- information. Template Haskell code is provided for supporting GHC
-- before version 7.2.
@package generic-deriving
@version 1.0.3
module Generics.Deriving.Base
-- | Void: used for datatypes without constructors
data V1 p :: * -> *
-- | Unit: used for constructors without arguments
data U1 p :: * -> *
U1 :: U1 p
-- | Used for marking occurrences of the parameter
newtype Par1 p :: * -> *
Par1 :: p -> Par1 p
unPar1 :: Par1 p -> p
-- | Recursive calls of kind * -> *
newtype Rec1 f :: (* -> *) p :: (* -> *) -> * -> *
Rec1 :: f p -> Rec1 p
unRec1 :: Rec1 p -> f p
-- | Constants, additional parameters and recursion of kind *
newtype K1 i c p :: * -> * -> * -> *
K1 :: c -> K1 i c p
unK1 :: K1 i c p -> c
-- | Meta-information (constructor names, etc.)
newtype M1 i c f :: (* -> *) p :: * -> * -> (* -> *) -> * -> *
M1 :: f p -> M1 i c p
unM1 :: M1 i c p -> f p
-- | Sums: encode choice between constructors
data (:+:) f :: (* -> *) g :: (* -> *) p :: (* -> *) -> (* -> *) -> * -> *
L1 :: f p -> :+: p
R1 :: g p -> :+: p
-- | Products: encode multiple arguments to constructors
data (:*:) f :: (* -> *) g :: (* -> *) p :: (* -> *) -> (* -> *) -> * -> *
(:*:) :: f p -> g p -> :*: p
-- | Composition of functors
newtype (:.:) f :: (* -> *) g :: (* -> *) p :: (* -> *) -> (* -> *) -> * -> *
Comp1 :: f (g p) -> :.: p
unComp1 :: :.: p -> f (g p)
-- | Type synonym for encoding recursion (of kind *)
type Rec0 = K1 R
-- | Type synonym for encoding parameters (other than the last)
type Par0 = K1 P
-- | Tag for K1: recursion (of kind *)
data R :: *
-- | Tag for K1: parameters (other than the last)
data P :: *
-- | Type synonym for encoding meta-information for datatypes
type D1 = M1 D
-- | Type synonym for encoding meta-information for constructors
type C1 = M1 C
-- | Type synonym for encoding meta-information for record selectors
type S1 = M1 S
-- | Tag for M1: datatype
data D :: *
-- | Tag for M1: constructor
data C :: *
-- | Tag for M1: record selector
data S :: *
-- | Class for datatypes that represent datatypes
class Datatype d
datatypeName :: Datatype d => t d f a -> [Char]
moduleName :: Datatype d => t d f a -> [Char]
-- | Class for datatypes that represent data constructors
class Constructor c
conName :: Constructor c => t c f a -> [Char]
conFixity :: Constructor c => t c f a -> Fixity
conIsRecord :: Constructor c => t c f a -> Bool
-- | Class for datatypes that represent records
class Selector s
selName :: Selector s => t s f a -> [Char]
-- | Used for constructor fields without a name
data NoSelector :: *
-- | Datatype to represent the fixity of a constructor. An infix |
-- declaration directly corresponds to an application of Infix.
data Fixity :: *
Prefix :: Fixity
Infix :: Associativity -> Int -> Fixity
-- | Datatype to represent the associativy of a constructor
data Associativity :: *
LeftAssociative :: Associativity
RightAssociative :: Associativity
NotAssociative :: Associativity
-- | Datatype to represent the arity of a tuple.
data Arity :: *
NoArity :: Arity
Arity :: Int -> Arity
-- | Get the precedence of a fixity value.
prec :: Fixity -> Int
-- | Representable types of kind *. This class is derivable in GHC with the
-- XDeriveRepresentable flag on.
class Generic a where { type family Rep a :: * -> *; }
from :: Generic a => a -> Rep a x
to :: Generic a => Rep a x -> a
-- | Representable types of kind * -> * (not yet derivable)
class Generic1 f :: (* -> *) where { type family Rep1 f :: (* -> *) :: * -> *; }
from1 :: Generic1 f => f a -> Rep1 f a
to1 :: Generic1 f => Rep1 f a -> f a
module Generics.Deriving.Instances
type Rep1Maybe = D1 Maybe_ (C1 Nothing_ U1 :+: C1 Just_ Par1)
type Rep1List = D1 List__ ((C1 Nil__ U1) :+: (C1 Cons__ (Par1 :*: Rec1 [])))
instance Generic1 []
instance Constructor Cons__
instance Constructor Nil__
instance Datatype List__
instance Generic1 Maybe
instance Constructor Just_
instance Constructor Nothing_
instance Datatype Maybe_
module Generics.Deriving.Eq
class GEq a
geq :: GEq a => a -> a -> Bool
instance GEq a => GEq [a]
instance GEq a => GEq (Maybe a)
instance GEq Float
instance GEq Int
instance GEq Char
instance (GEq' a, GEq' b) => GEq' (a :*: b)
instance (GEq' a, GEq' b) => GEq' (a :+: b)
instance GEq' a => GEq' (M1 i c a)
instance GEq c => GEq' (K1 i c)
instance GEq' U1
module Generics.Deriving.Enum
class GEnum a
genum :: GEnum a => [a]
genumDefault :: (Generic a, Enum' (Rep a)) => [a]
toEnumDefault :: (Generic a, Enum' (Rep a)) => Int -> a
fromEnumDefault :: (GEq a, Generic a, Enum' (Rep a)) => a -> Int
class Ord a => GIx a
range :: GIx a => (a, a) -> [a]
index :: GIx a => (a, a) -> a -> Int
inRange :: GIx a => (a, a) -> a -> Bool
rangeDefault :: (GEq a, Generic a, Enum' (Rep a)) => (a, a) -> [a]
indexDefault :: (GEq a, Generic a, Enum' (Rep a)) => (a, a) -> a -> Int
inRangeDefault :: (GEq a, Generic a, Enum' (Rep a)) => (a, a) -> a -> Bool
instance GIx Int
instance (GEq a, GEnum a, GIx a) => GIx [a]
instance (GEq a, GEnum a, GIx a) => GIx (Maybe a)
instance GEnum Int
instance GEnum a => GEnum [a]
instance GEnum a => GEnum (Maybe a)
instance (Enum' f, Enum' g) => Enum' (f :*: g)
instance (Enum' f, Enum' g) => Enum' (f :+: g)
instance Enum' f => Enum' (M1 i c f)
instance GEnum c => Enum' (K1 i c)
instance Enum' U1
module Generics.Deriving.Functor
class GFunctor f
gmap :: GFunctor f => (a -> b) -> f a -> f b
gmapdefault :: (Generic1 f, GFunctor' (Rep1 f)) => (a -> b) -> f a -> f b
instance GFunctor []
instance GFunctor Maybe
instance (GFunctor f, GFunctor' g) => GFunctor' (f :.: g)
instance (GFunctor' f, GFunctor' g) => GFunctor' (f :*: g)
instance (GFunctor' f, GFunctor' g) => GFunctor' (f :+: g)
instance GFunctor' f => GFunctor' (M1 i c f)
instance GFunctor f => GFunctor' (Rec1 f)
instance GFunctor' (K1 i c)
instance GFunctor' Par1
instance GFunctor' U1
module Generics.Deriving.Show
class GShow a
gshowsPrec :: GShow a => Int -> a -> ShowS
gshows :: GShow a => a -> ShowS
gshow :: GShow a => a -> String
gshowsPrecdefault :: (Generic a, GShow' (Rep a)) => Int -> a -> ShowS
instance [overlap ok] GShow a => GShow [a]
instance [overlap ok] GShow Bool
instance [overlap ok] GShow String
instance [overlap ok] GShow Float
instance [overlap ok] GShow Int
instance [overlap ok] GShow Char
instance [overlap ok] GShow a => GShow (Maybe a)
instance [overlap ok] (GShow' a, GShow' b) => GShow' (a :*: b)
instance [overlap ok] (GShow' a, GShow' b) => GShow' (a :+: b)
instance [overlap ok] GShow' a => GShow' (M1 D d a)
instance [overlap ok] (Selector s, GShow' a) => GShow' (M1 S s a)
instance [overlap ok] (GShow' a, Constructor c) => GShow' (M1 C c a)
instance [overlap ok] GShow c => GShow' (K1 i c)
instance [overlap ok] GShow' U1
module Generics.Deriving.Uniplate
class Uniplate a
children :: Uniplate a => a -> [a]
childrendefault :: (Generic a, Uniplate' (Rep a) a) => a -> [a]
instance [overlap ok] Uniplate a => Uniplate (Maybe a)
instance [overlap ok] Uniplate [a]
instance [overlap ok] Uniplate Float
instance [overlap ok] Uniplate Int
instance [overlap ok] Uniplate Char
instance [overlap ok] (Uniplate' f b, Uniplate' g b) => Uniplate' (f :*: g) b
instance [overlap ok] (Uniplate' f b, Uniplate' g b) => Uniplate' (f :+: g) b
instance [overlap ok] Uniplate' f b => Uniplate' (M1 i c f) b
instance [overlap ok] Uniplate' (K1 i a) b
instance [overlap ok] Uniplate' (K1 i a) a
instance [overlap ok] Uniplate' U1 a
-- | This module contains Template Haskell code that can be used to
-- automatically generate the boilerplate code for the generic deriving
-- library. For now, it generates only the Generic instance. Empty
-- datatypes are not yet supported.
module Generics.Deriving.TH
-- | Given the type and the name (as string) for the type to derive,
-- generate the Data instance, the Constructor instances,
-- and the Selector instances.
deriveMeta :: Name -> Q [Dec]
-- | Given a datatype name, derive a datatype and instance of class
-- Datatype.
deriveData :: Name -> Q [Dec]
-- | Given a datatype name, derive datatypes and instances of class
-- Constructor.
deriveConstructors :: Name -> Q [Dec]
-- | Given a datatype name, derive datatypes and instances of class
-- Selector.
deriveSelectors :: Name -> Q [Dec]
instance Lift Associativity
instance Lift Fixity
module Generics.Deriving