Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Generic a
- type family Rep a :: Type -> Type
- class Generic1 (f :: k -> Type)
- type family Rep1 (f :: k -> Type) :: k -> Type
- data V1 (p :: k) :: forall k. k -> Type
- data U1 (p :: k) :: forall k. k -> Type
- data ((f :: k -> Type) :+: (g :: k -> Type)) (p :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type
- data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type
- data K1 i c (p :: k) :: forall k. Type -> Type -> k -> Type
- data M1 i (c :: Meta) (f :: k -> Type) (p :: k) :: forall k. Type -> Meta -> (k -> Type) -> k -> Type
- data (c :=>: (f :: k -> Type)) (a :: k) :: forall k. Constraint -> (k -> Type) -> k -> Type
- data SMeta i t where
- data SRep w f where
- type GenericSy a = (Generic a, Sy (Rep a))
- fromS :: (GenericSy a, Applicative w) => a -> SRep w (Rep a)
- toS :: (GenericSy a, Comonad w) => SRep w (Rep a) -> a
- fromI :: GenericSy a => a -> SRep Identity (Rep a)
- toI :: GenericSy a => SRep Identity (Rep a) -> a
- type family OnLeaves (c :: * -> Constraint) (f :: * -> *) :: Constraint where ...
- data SRep1 f x where
- S1_U1 :: SRep1 U1 x
- S1_L1 :: SRep1 f x -> SRep1 (f :+: g) x
- S1_R1 :: SRep1 g x -> SRep1 (f :+: g) x
- (:***:) :: SRep1 f x -> SRep1 g x -> SRep1 (f :*: g) x
- S1_K1 :: a -> SRep1 (K1 i a) x
- S1_M1 :: SMeta i t -> SRep1 f x -> SRep1 (M1 i t f) x
- S1_ST :: c => SRep1 f x -> SRep1 (c :=>: f) x
- S1_Par :: x -> SRep1 Par1 x
- S1_Rec :: f x -> SRep1 (Rec1 f) x
- S1_Comp :: f (SRep1 g x) -> SRep1 (f :.: g) x
- type GenericSy1 f = (Generic1 f, Sy1 (Rep1 f))
- fromS1 :: GenericSy1 f => f a -> SRep1 (Rep1 f) a
- toS1 :: GenericSy1 f => SRep1 (Rep1 f) a -> f a
- type family OnLeaves1 (c :: * -> Constraint) (r :: (* -> *) -> Constraint) (f :: * -> *) :: Constraint where ...
- class c => d => Implies c d
- class Trivial c
From Extra
module
Representable types of kind *
.
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic
instance must satisfy the following laws:
from
.to
≡id
to
.from
≡id
Instances
type family Rep a :: Type -> Type #
Generic representation type
Instances
class Generic1 (f :: k -> Type) #
Representable types of kind * -> *
(or kind k -> *
, when PolyKinds
is enabled).
This class is derivable in GHC with the DeriveGeneric
flag on.
A Generic1
instance must satisfy the following laws:
from1
.to1
≡id
to1
.from1
≡id
Instances
type family Rep1 (f :: k -> Type) :: k -> Type #
Generic representation type
Instances
data V1 (p :: k) :: forall k. k -> Type #
Void: used for datatypes without constructors
Instances
Generic1 (V1 :: k -> Type) | |
Functor (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Foldable (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => V1 m -> m # foldMap :: Monoid m => (a -> m) -> V1 a -> m # foldr :: (a -> b -> b) -> b -> V1 a -> b # foldr' :: (a -> b -> b) -> b -> V1 a -> b # foldl :: (b -> a -> b) -> b -> V1 a -> b # foldl' :: (b -> a -> b) -> b -> V1 a -> b # foldr1 :: (a -> a -> a) -> V1 a -> a # foldl1 :: (a -> a -> a) -> V1 a -> a # elem :: Eq a => a -> V1 a -> Bool # maximum :: Ord a => V1 a -> a # | |
Traversable (V1 :: Type -> Type) | Since: base-4.9.0.0 |
Eq (V1 p) | Since: base-4.9.0.0 |
Ord (V1 p) | Since: base-4.9.0.0 |
Read (V1 p) | Since: base-4.9.0.0 |
Show (V1 p) | Since: base-4.9.0.0 |
Generic (V1 p) | |
Semigroup (V1 p) | Since: base-4.12.0.0 |
type Rep1 (V1 :: k -> Type) | Since: base-4.9.0.0 |
type Rep (V1 p) | Since: base-4.9.0.0 |
data U1 (p :: k) :: forall k. k -> Type #
Unit: used for constructors without arguments
Instances
Generic1 (U1 :: k -> Type) | |
Monad (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Functor (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Applicative (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Foldable (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => U1 m -> m # foldMap :: Monoid m => (a -> m) -> U1 a -> m # foldr :: (a -> b -> b) -> b -> U1 a -> b # foldr' :: (a -> b -> b) -> b -> U1 a -> b # foldl :: (b -> a -> b) -> b -> U1 a -> b # foldl' :: (b -> a -> b) -> b -> U1 a -> b # foldr1 :: (a -> a -> a) -> U1 a -> a # foldl1 :: (a -> a -> a) -> U1 a -> a # elem :: Eq a => a -> U1 a -> Bool # maximum :: Ord a => U1 a -> a # | |
Traversable (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Alternative (U1 :: Type -> Type) | Since: base-4.9.0.0 |
MonadPlus (U1 :: Type -> Type) | Since: base-4.9.0.0 |
Eq (U1 p) | Since: base-4.9.0.0 |
Ord (U1 p) | Since: base-4.7.0.0 |
Read (U1 p) | Since: base-4.9.0.0 |
Show (U1 p) | Since: base-4.9.0.0 |
Generic (U1 p) | |
Semigroup (U1 p) | Since: base-4.12.0.0 |
Monoid (U1 p) | Since: base-4.12.0.0 |
type Rep1 (U1 :: k -> Type) | Since: base-4.9.0.0 |
type Rep (U1 p) | Since: base-4.7.0.0 |
data ((f :: k -> Type) :+: (g :: k -> Type)) (p :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type infixr 5 #
Sums: encode choice between constructors
Instances
Generic1 (f :+: g :: k -> Type) | |
(Functor f, Functor g) => Functor (f :+: g) | Since: base-4.9.0.0 |
(Foldable f, Foldable g) => Foldable (f :+: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => (f :+: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :+: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :+: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :+: g) a -> b # foldr1 :: (a -> a -> a) -> (f :+: g) a -> a # foldl1 :: (a -> a -> a) -> (f :+: g) a -> a # toList :: (f :+: g) a -> [a] # length :: (f :+: g) a -> Int # elem :: Eq a => a -> (f :+: g) a -> Bool # maximum :: Ord a => (f :+: g) a -> a # minimum :: Ord a => (f :+: g) a -> a # | |
(Traversable f, Traversable g) => Traversable (f :+: g) | Since: base-4.9.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :+: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :+: g) p) | Since: base-4.7.0.0 |
(Read (f p), Read (g p)) => Read ((f :+: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :+: g) p) | Since: base-4.7.0.0 |
Generic ((f :+: g) p) | |
type Rep1 (f :+: g :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics type Rep1 (f :+: g :: k -> Type) = D1 (MetaData ":+:" "GHC.Generics" "base" False) (C1 (MetaCons "L1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f)) :+: C1 (MetaCons "R1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 g))) | |
type Rep ((f :+: g) p) | Since: base-4.7.0.0 |
Defined in GHC.Generics type Rep ((f :+: g) p) = D1 (MetaData ":+:" "GHC.Generics" "base" False) (C1 (MetaCons "L1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f p))) :+: C1 (MetaCons "R1" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (g p)))) |
data ((f :: k -> Type) :*: (g :: k -> Type)) (p :: k) :: forall k. (k -> Type) -> (k -> Type) -> k -> Type infixr 6 #
Products: encode multiple arguments to constructors
Instances
Generic1 (f :*: g :: k -> Type) | |
(Monad f, Monad g) => Monad (f :*: g) | Since: base-4.9.0.0 |
(Functor f, Functor g) => Functor (f :*: g) | Since: base-4.9.0.0 |
(Applicative f, Applicative g) => Applicative (f :*: g) | Since: base-4.9.0.0 |
(Foldable f, Foldable g) => Foldable (f :*: g) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => (f :*: g) m -> m # foldMap :: Monoid m => (a -> m) -> (f :*: g) a -> m # foldr :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldr' :: (a -> b -> b) -> b -> (f :*: g) a -> b # foldl :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldl' :: (b -> a -> b) -> b -> (f :*: g) a -> b # foldr1 :: (a -> a -> a) -> (f :*: g) a -> a # foldl1 :: (a -> a -> a) -> (f :*: g) a -> a # toList :: (f :*: g) a -> [a] # length :: (f :*: g) a -> Int # elem :: Eq a => a -> (f :*: g) a -> Bool # maximum :: Ord a => (f :*: g) a -> a # minimum :: Ord a => (f :*: g) a -> a # | |
(Traversable f, Traversable g) => Traversable (f :*: g) | Since: base-4.9.0.0 |
(Alternative f, Alternative g) => Alternative (f :*: g) | Since: base-4.9.0.0 |
(MonadPlus f, MonadPlus g) => MonadPlus (f :*: g) | Since: base-4.9.0.0 |
(Eq (f p), Eq (g p)) => Eq ((f :*: g) p) | Since: base-4.7.0.0 |
(Ord (f p), Ord (g p)) => Ord ((f :*: g) p) | Since: base-4.7.0.0 |
(Read (f p), Read (g p)) => Read ((f :*: g) p) | Since: base-4.7.0.0 |
(Show (f p), Show (g p)) => Show ((f :*: g) p) | Since: base-4.7.0.0 |
Generic ((f :*: g) p) | |
(Semigroup (f p), Semigroup (g p)) => Semigroup ((f :*: g) p) | Since: base-4.12.0.0 |
(Monoid (f p), Monoid (g p)) => Monoid ((f :*: g) p) | Since: base-4.12.0.0 |
type Rep1 (f :*: g :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics type Rep1 (f :*: g :: k -> Type) = D1 (MetaData ":*:" "GHC.Generics" "base" False) (C1 (MetaCons ":*:" (InfixI RightAssociative 6) False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 f) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec1 g))) | |
type Rep ((f :*: g) p) | Since: base-4.7.0.0 |
Defined in GHC.Generics type Rep ((f :*: g) p) = D1 (MetaData ":*:" "GHC.Generics" "base" False) (C1 (MetaCons ":*:" (InfixI RightAssociative 6) False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (f p)) :*: S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (g p)))) |
data K1 i c (p :: k) :: forall k. Type -> Type -> k -> Type #
Constants, additional parameters and recursion of kind *
Instances
Generic1 (K1 i c :: k -> Type) | |
Functor (K1 i c :: Type -> Type) | Since: base-4.9.0.0 |
Monoid c => Applicative (K1 i c :: Type -> Type) | Since: base-4.12.0.0 |
Foldable (K1 i c :: Type -> Type) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => K1 i c m -> m # foldMap :: Monoid m => (a -> m) -> K1 i c a -> m # foldr :: (a -> b -> b) -> b -> K1 i c a -> b # foldr' :: (a -> b -> b) -> b -> K1 i c a -> b # foldl :: (b -> a -> b) -> b -> K1 i c a -> b # foldl' :: (b -> a -> b) -> b -> K1 i c a -> b # foldr1 :: (a -> a -> a) -> K1 i c a -> a # foldl1 :: (a -> a -> a) -> K1 i c a -> a # elem :: Eq a => a -> K1 i c a -> Bool # maximum :: Ord a => K1 i c a -> a # minimum :: Ord a => K1 i c a -> a # | |
Traversable (K1 i c :: Type -> Type) | Since: base-4.9.0.0 |
Eq c => Eq (K1 i c p) | Since: base-4.7.0.0 |
Ord c => Ord (K1 i c p) | Since: base-4.7.0.0 |
Defined in GHC.Generics | |
Read c => Read (K1 i c p) | Since: base-4.7.0.0 |
Show c => Show (K1 i c p) | Since: base-4.7.0.0 |
Generic (K1 i c p) | |
Semigroup c => Semigroup (K1 i c p) | Since: base-4.12.0.0 |
Monoid c => Monoid (K1 i c p) | Since: base-4.12.0.0 |
type Rep1 (K1 i c :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Rep (K1 i c p) | Since: base-4.7.0.0 |
Defined in GHC.Generics |
data M1 i (c :: Meta) (f :: k -> Type) (p :: k) :: forall k. Type -> Meta -> (k -> Type) -> k -> Type #
Meta-information (constructor names, etc.)
Instances
Generic1 (M1 i c f :: k -> Type) | |
Monad f => Monad (M1 i c f) | Since: base-4.9.0.0 |
Functor f => Functor (M1 i c f) | Since: base-4.9.0.0 |
Applicative f => Applicative (M1 i c f) | Since: base-4.9.0.0 |
Foldable f => Foldable (M1 i c f) | Since: base-4.9.0.0 |
Defined in Data.Foldable fold :: Monoid m => M1 i c f m -> m # foldMap :: Monoid m => (a -> m) -> M1 i c f a -> m # foldr :: (a -> b -> b) -> b -> M1 i c f a -> b # foldr' :: (a -> b -> b) -> b -> M1 i c f a -> b # foldl :: (b -> a -> b) -> b -> M1 i c f a -> b # foldl' :: (b -> a -> b) -> b -> M1 i c f a -> b # foldr1 :: (a -> a -> a) -> M1 i c f a -> a # foldl1 :: (a -> a -> a) -> M1 i c f a -> a # elem :: Eq a => a -> M1 i c f a -> Bool # maximum :: Ord a => M1 i c f a -> a # minimum :: Ord a => M1 i c f a -> a # | |
Traversable f => Traversable (M1 i c f) | Since: base-4.9.0.0 |
Alternative f => Alternative (M1 i c f) | Since: base-4.9.0.0 |
MonadPlus f => MonadPlus (M1 i c f) | Since: base-4.9.0.0 |
Eq (f p) => Eq (M1 i c f p) | Since: base-4.7.0.0 |
Ord (f p) => Ord (M1 i c f p) | Since: base-4.7.0.0 |
Read (f p) => Read (M1 i c f p) | Since: base-4.7.0.0 |
Show (f p) => Show (M1 i c f p) | Since: base-4.7.0.0 |
Generic (M1 i c f p) | |
Semigroup (f p) => Semigroup (M1 i c f p) | Since: base-4.12.0.0 |
Monoid (f p) => Monoid (M1 i c f p) | Since: base-4.12.0.0 |
type Rep1 (M1 i c f :: k -> Type) | Since: base-4.9.0.0 |
Defined in GHC.Generics | |
type Rep (M1 i c f p) | Since: base-4.7.0.0 |
Defined in GHC.Generics |
data (c :=>: (f :: k -> Type)) (a :: k) :: forall k. Constraint -> (k -> Type) -> k -> Type #
Constraints: used to represent constraints in a constructor.
data Showable a = Show a => a -> X a instance Generic (Showable a) where type Rep (Showable a) = (Show a) :=>: (K1 R a)
Simplistic representation on *
types
Constraints over the leaves of a data type
type family OnLeaves (c :: * -> Constraint) (f :: * -> *) :: Constraint where ... Source #
Simplistic representation on `* -> *` types
S1_U1 :: SRep1 U1 x | |
S1_L1 :: SRep1 f x -> SRep1 (f :+: g) x | |
S1_R1 :: SRep1 g x -> SRep1 (f :+: g) x | |
(:***:) :: SRep1 f x -> SRep1 g x -> SRep1 (f :*: g) x infixr 5 | |
S1_K1 :: a -> SRep1 (K1 i a) x | |
S1_M1 :: SMeta i t -> SRep1 f x -> SRep1 (M1 i t f) x | |
S1_ST :: c => SRep1 f x -> SRep1 (c :=>: f) x | |
S1_Par :: x -> SRep1 Par1 x | |
S1_Rec :: f x -> SRep1 (Rec1 f) x | |
S1_Comp :: f (SRep1 g x) -> SRep1 (f :.: g) x |
type GenericSy1 f = (Generic1 f, Sy1 (Rep1 f)) Source #
Constraints over the leaves of a data type
type family OnLeaves1 (c :: * -> Constraint) (r :: (* -> *) -> Constraint) (f :: * -> *) :: Constraint where ... Source #
OnLeaves1 c r V1 = () | |
OnLeaves1 c r U1 = () | |
OnLeaves1 c r (f :+: g) = (OnLeaves1 c r f, OnLeaves1 c r g) | |
OnLeaves1 c r (f :*: g) = (OnLeaves1 c r f, OnLeaves1 c r g) | |
OnLeaves1 c r (K1 i a) = c a | |
OnLeaves1 c r (M1 i p f) = OnLeaves1 c r f | |
OnLeaves1 c r (d :=>: f) = Implies d (OnLeaves1 c r f) | |
OnLeaves1 c r Par1 = () | |
OnLeaves1 c r (Rec1 f) = r f | |
OnLeaves1 c r (f :.: g) = (r f, OnLeaves1 c r g) |