-- 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 is described in the
-- paper:
--
--
-- - A generic deriving mechanism for Haskell. Jose Pedro
-- Magalhaes, Atze Dijkstra, Johan Jeuring, and Andres Loeh.
-- Haskell'10.
--
@package generic-deriving
@version 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 f p
unRec1 :: Rec1 f 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 f p
unM1 :: M1 i c f p -> f p
-- | Sums: encode choice between constructors
data (:+:) f g p
L1 :: f p -> :+: f g p
unL1 :: :+: f g p -> f p
R1 :: g p -> :+: f g p
unR1 :: :+: f g p -> g p
-- | Products: encode multiple arguments to constructors
data (:*:) f g p
(:*:) :: f p -> g p -> :*: f g p
-- | Composition of functors
newtype (:.:) f g p
Comp1 :: f (g p) -> :.: f g p
unComp1 :: :.: f g 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 -> String
moduleName :: (Datatype d) => t d (f :: * -> *) a -> String
-- | Class for datatypes that represent data constructors
class Constructor c
conName :: (Constructor c) => t c (f :: * -> *) a -> String
conFixity :: (Constructor c) => t c (f :: * -> *) a -> Fixity
conIsRecord :: (Constructor c) => t c (f :: * -> *) a -> Bool
conIsTuple :: (Constructor c) => t c (f :: * -> *) a -> Arity
-- | Class for datatypes that represent records
class Selector s
selName :: (Selector s) => t s (f :: * -> *) a -> String
-- | 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 *
class Representable0 a rep
from0 :: (Representable0 a rep) => a -> rep x
to0 :: (Representable0 a rep) => rep x -> a
-- | Representable types of kind * -> *
class Representable1 f rep
from1 :: (Representable1 f rep) => f a -> rep a
to1 :: (Representable1 f rep) => rep a -> f a
type Rep0Char = Rec0 Char
type Rep0Int = Rec0 Int
type Rep0Float = Rec0 Float
type Rep0Maybe a = D1 Maybe_ (C1 Nothing_ U1 :+: C1 Just_ (Par0 a))
type Rep1Maybe = D1 Maybe_ (C1 Nothing_ U1 :+: C1 Just_ Par1)
type Rep0List a = D1 List__ ((C1 Nil__ U1) :+: (C1 Cons__ (Par0 a :*: Rec0 [a])))
type Rep1List = D1 List__ ((C1 Nil__ U1) :+: (C1 Cons__ (Par1 :*: Rec1 [])))
instance Eq Associativity
instance Show Associativity
instance Ord Associativity
instance Read Associativity
instance Eq Fixity
instance Show Fixity
instance Ord Fixity
instance Read Fixity
instance Eq Arity
instance Show Arity
instance Ord Arity
instance Read Arity
instance Representable1 [] Rep1List
instance Representable0 [a] (Rep0List a)
instance Constructor Cons__
instance Constructor Nil__
instance Datatype [a]
instance Representable1 Maybe Rep1Maybe
instance Representable0 (Maybe a) (Rep0Maybe a)
instance Constructor Just_
instance Constructor Nothing_
instance Datatype Maybe_
instance Representable0 Float Rep0Float
instance Representable0 Int Rep0Int
instance Representable0 Char Rep0Char
instance Selector NoSelector
module Generics.Deriving.Eq
class GEq a
geq :: (GEq a) => a -> a -> Bool
geqdefault :: (Representable0 a rep0, GEq' rep0) => rep0 x -> 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 :: (Representable0 a rep0, Enum' rep0) => rep0 x -> [a]
toEnumDefault :: (Representable0 a rep0, Enum' rep0) => rep0 x -> Int -> a
fromEnumDefault :: (GEq a, Representable0 a rep0, Enum' rep0) => rep0 x -> 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, Representable0 a rep0, Enum' rep0) => rep0 x -> (a, a) -> [a]
indexDefault :: (GEq a, Representable0 a rep0, Enum' rep0) => rep0 x -> (a, a) -> a -> Int
inRangeDefault :: (GEq a, Representable0 a rep0, Enum' rep0) => rep0 x -> (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 :: (Representable1 f rep, GFunctor' rep) => rep a -> (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 :: (Representable0 a rep0, GShow' rep0) => rep0 x -> Int -> a -> ShowS
instance [incoherent] (GShow a) => GShow [a]
instance [incoherent] GShow Bool
instance [incoherent] GShow String
instance [incoherent] GShow Float
instance [incoherent] GShow Int
instance [incoherent] GShow Char
instance [incoherent] (GShow a) => GShow (Maybe a)
instance [incoherent] (GShow' a, GShow' b) => GShow' (a :*: b)
instance [incoherent] (GShow' a, GShow' b) => GShow' (a :+: b)
instance [incoherent] (GShow' a) => GShow' (M1 D d a)
instance [incoherent] (Selector s, GShow' a) => GShow' (M1 S s a)
instance [incoherent] (GShow' a, Constructor c) => GShow' (M1 C c a)
instance [incoherent] (GShow c) => GShow' (K1 i c)
instance [incoherent] GShow' U1
module Generics.Deriving.Typeable
typeOf0default :: (Representable0 a rep, Typeable0' rep) => rep x -> a -> TypeRep
typeOf1default :: (Representable1 f rep, Typeable1' rep a) => rep a -> f a -> TypeRep
instance (Typeable a, Datatype d) => Typeable1' (M1 D d f) a
instance (Datatype d) => Typeable0' (M1 D d a)
module Generics.Deriving.Uniplate
class Uniplate a
children :: (Uniplate a) => a -> [a]
childrendefault :: (Representable0 a rep0, Uniplate' rep0 a) => rep0 x -> a -> [a]
instance [incoherent] (Uniplate a) => Uniplate (Maybe a)
instance [incoherent] Uniplate [a]
instance [incoherent] Uniplate Float
instance [incoherent] Uniplate Int
instance [incoherent] Uniplate Char
instance [incoherent] (Uniplate' f b, Uniplate' g b) => Uniplate' (f :*: g) b
instance [incoherent] (Uniplate' f b, Uniplate' g b) => Uniplate' (f :+: g) b
instance [incoherent] (Uniplate' f b) => Uniplate' (M1 i c f) b
instance [incoherent] Uniplate' (K1 i a) b
instance [incoherent] Uniplate' (K1 i a) a
instance [incoherent] 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 Representable0
-- 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,
-- the Selector instances, and the Representable0 instance.
deriveAll :: 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]
-- | Given the type and the name (as string) for the Representable0 type
-- synonym to derive, generate the Representable0 instance.
deriveRepresentable0 :: Name -> Q [Dec]
-- | Derive only the Rep0 type synonym. Not needed if
-- deriveRepresentable0 is used.
deriveRep0 :: Name -> Q [Dec]
-- | Given the names of a generic class, a type to instantiate, a function
-- in the class and the default implementation, generates the code for a
-- basic generic instance.
simplInstance :: Name -> Name -> Name -> Name -> Q [Dec]
instance Lift Associativity
instance Lift Fixity
module Generics.Deriving