License | BSD-style (see the file LICENSE) |
---|---|
Maintainer | sjoerd@w3future.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- to :: Generic a => Rep a x -> a
- from :: Generic a => a -> Rep a x
- to1 :: Generic1 f => Rep1 f x -> f x
- from1 :: Generic1 f => f x -> Rep1 f x
- type family Constraints' (t :: Type -> Type) (t' :: Type -> Type) (c :: Type -> Type -> Constraint) (c1 :: (Type -> Type) -> (Type -> Type) -> Constraint) :: Constraint
- type ADT' = ADT_ Identity Proxy ADTProfunctor
- type ADTNonEmpty' = ADT_ Identity Proxy NonEmptyProfunctor
- type ADTRecord' = ADT_ Identity Proxy RecordProfunctor
- type ADT1' t t' = (ADT_ Identity Identity ADTProfunctor t t', ADT_ Proxy Identity ADT1Profunctor t t')
- type ADTNonEmpty1' t t' = (ADT_ Identity Identity NonEmptyProfunctor t t', ADT_ Proxy Identity NonEmptyProfunctor t t')
- type ADTRecord1' t t' = (ADT_ Identity Identity RecordProfunctor t t', ADT_ Proxy Identity RecordProfunctor t t')
- type ADTProfunctor = GenericEmptyProfunctor ': NonEmptyProfunctor
- type ADT1Profunctor = GenericConstantProfunctor ': ADTProfunctor
- type NonEmptyProfunctor = GenericSumProfunctor ': RecordProfunctor
- type RecordProfunctor = '[GenericProductProfunctor, GenericUnitProfunctor, Profunctor]
- type family Satisfies (p :: Type -> Type -> Type) (ks :: [(Type -> Type -> Type) -> Constraint]) :: Constraint
- class (ks :: [(Type -> Type -> Type) -> Constraint]) |- (k :: (Type -> Type -> Type) -> Constraint) where
- generic' :: forall ks c p t t' a b. (ADT_ Identity Proxy ks t t', Constraints' t t' c AnyType, Satisfies p ks) => (forall s s'. c s s' => p s s') -> p (t a) (t' b)
- generic1' :: forall ks c1 p t t' a b. (ADT_ Proxy Identity ks t t', Constraints' t t' AnyType c1, Satisfies p ks) => (forall s s' d e. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- generic01' :: forall ks c0 c1 p t t' a b. (ADT_ Identity Identity ks t t', Constraints' t t' c0 c1, Satisfies p ks) => (forall s s'. c0 s s' => p s s') -> (forall s s' d e. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- class ADT_ (nullary :: Type -> Type) (unary :: Type -> Type) (ks :: [(Type -> Type -> Type) -> Constraint]) (t :: Type -> Type) (t' :: Type -> Type) where
- generic_ :: forall c c1 p a b. (Constraints' t t' c c1, Satisfies p ks) => Proxy c -> (forall s s'. c s s' => nullary (p s s')) -> Proxy c1 -> (forall r1 s1 d e. c1 r1 s1 => unary (p d e -> p (r1 d) (s1 e))) -> unary (p a b) -> p (t a) (t' b)
- data Ctor a b = Ctor {}
- record :: forall c p t t'. (ADTRecord t t', Constraints t t' c, GenericRecordProfunctor p) => (forall s s'. c s s' => p s s') -> p t t'
- record1 :: forall c p t t' a b. (ADTRecord1 t t', Constraints1 t t' c, GenericRecordProfunctor p) => (forall d e s s'. c s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- record01 :: forall c0 c1 p t t' a b. (ADTRecord1 t t', Constraints01 t t' c0 c1, GenericRecordProfunctor p) => (forall s s'. c0 s s' => p s s') -> (forall d e s s'. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- nonEmpty :: forall c p t t'. (ADTNonEmpty t t', Constraints t t' c, GenericNonEmptyProfunctor p) => (forall s s'. c s s' => p s s') -> p t t'
- nonEmpty1 :: forall c p t t' a b. (ADTNonEmpty1 t t', Constraints1 t t' c, GenericNonEmptyProfunctor p) => (forall d e s s'. c s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- nonEmpty01 :: forall c0 c1 p t t' a b. (ADTNonEmpty1 t t', Constraints01 t t' c0 c1, GenericNonEmptyProfunctor p) => (forall s s'. c0 s s' => p s s') -> (forall d e s s'. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- generic :: forall c p t t'. (ADT t t', Constraints t t' c, GenericProfunctor p) => (forall s s'. c s s' => p s s') -> p t t'
- generic1 :: forall c p t t' a b. (ADT1 t t', Constraints1 t t' c, Generic1Profunctor p) => (forall d e s s'. c s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- generic01 :: forall c0 c1 p t t' a b. (ADT1 t t', Constraints01 t t' c0 c1, GenericProfunctor p) => (forall s s'. c0 s s' => p s s') -> (forall d e s s'. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b)
- type Constraints t t' c = Constraints' (Rep t) (Rep t') c AnyType
- type Constraints1 t t' c = Constraints' (Rep1 t) (Rep1 t') AnyType c
- type Constraints01 t t' c0 c1 = Constraints' (Rep1 t) (Rep1 t') c0 c1
- type ADTRecord t t' = (Generic t, Generic t', ADTRecord' (Rep t) (Rep t'), Constraints t t' AnyType)
- type ADTRecord1 t t' = (Generic1 t, Generic1 t', ADTRecord1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType)
- type ADTNonEmpty t t' = (Generic t, Generic t', ADTNonEmpty' (Rep t) (Rep t'), Constraints t t' AnyType)
- type ADTNonEmpty1 t t' = (Generic1 t, Generic1 t', ADTNonEmpty1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType)
- type ADT t t' = (Generic t, Generic t', ADT' (Rep t) (Rep t'), Constraints t t' AnyType)
- type ADT1 t t' = (Generic1 t, Generic1 t', ADT1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType)
- class AnyType a b
- type family FunResult t where ...
- class FunConstraints c t where
- autoApply :: Applicative f => (forall s. c s => f s) -> f t -> f (FunResult t)
- data Pair a = Pair a a
- (.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d
Documentation
type family Constraints' (t :: Type -> Type) (t' :: Type -> Type) (c :: Type -> Type -> Constraint) (c1 :: (Type -> Type) -> (Type -> Type) -> Constraint) :: Constraint Source #
Instances
type Constraints' Par1 Par1 c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (V1 :: Type -> Type) (V1 :: Type -> Type) c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (U1 :: Type -> Type) (U1 :: Type -> Type) c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (Rec1 f) (Rec1 g) c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (K1 i a :: Type -> Type) (K1 i' b :: Type -> Type) c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (f :+: g) (f' :+: g') c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (f :*: g) (f' :*: g') c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (M1 i t f) (M1 i' t' f') c c1 Source # | |
Defined in Generics.OneLiner.Internal | |
type Constraints' (f :.: g) (f' :.: g') c c1 Source # | |
Defined in Generics.OneLiner.Internal |
type ADTRecord' = ADT_ Identity Proxy RecordProfunctor Source #
type ADT1' t t' = (ADT_ Identity Identity ADTProfunctor t t', ADT_ Proxy Identity ADT1Profunctor t t') Source #
type ADTNonEmpty1' t t' = (ADT_ Identity Identity NonEmptyProfunctor t t', ADT_ Proxy Identity NonEmptyProfunctor t t') Source #
type ADTRecord1' t t' = (ADT_ Identity Identity RecordProfunctor t t', ADT_ Proxy Identity RecordProfunctor t t') Source #
type family Satisfies (p :: Type -> Type -> Type) (ks :: [(Type -> Type -> Type) -> Constraint]) :: Constraint Source #
Instances
type Satisfies p ('[] :: [(Type -> Type -> Type) -> Constraint]) Source # | |
Defined in Generics.OneLiner.Internal | |
type Satisfies p (k ': ks) Source # | |
Defined in Generics.OneLiner.Internal |
class (ks :: [(Type -> Type -> Type) -> Constraint]) |- (k :: (Type -> Type -> Type) -> Constraint) where Source #
generic' :: forall ks c p t t' a b. (ADT_ Identity Proxy ks t t', Constraints' t t' c AnyType, Satisfies p ks) => (forall s s'. c s s' => p s s') -> p (t a) (t' b) Source #
generic1' :: forall ks c1 p t t' a b. (ADT_ Proxy Identity ks t t', Constraints' t t' AnyType c1, Satisfies p ks) => (forall s s' d e. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
generic01' :: forall ks c0 c1 p t t' a b. (ADT_ Identity Identity ks t t', Constraints' t t' c0 c1, Satisfies p ks) => (forall s s'. c0 s s' => p s s') -> (forall s s' d e. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
class ADT_ (nullary :: Type -> Type) (unary :: Type -> Type) (ks :: [(Type -> Type -> Type) -> Constraint]) (t :: Type -> Type) (t' :: Type -> Type) where Source #
generic_ :: forall c c1 p a b. (Constraints' t t' c c1, Satisfies p ks) => Proxy c -> (forall s s'. c s s' => nullary (p s s')) -> Proxy c1 -> (forall r1 s1 d e. c1 r1 s1 => unary (p d e -> p (r1 d) (s1 e))) -> unary (p a b) -> p (t a) (t' b) Source #
Instances
ks |- Profunctor => ADT_ nullary Identity ks Par1 Par1 Source # | |
Defined in Generics.OneLiner.Internal | |
ks |- GenericUnitProfunctor => ADT_ nullary unary ks (U1 :: Type -> Type) (U1 :: Type -> Type) Source # | |
Defined in Generics.OneLiner.Internal | |
ks |- GenericEmptyProfunctor => ADT_ nullary unary ks (V1 :: Type -> Type) (V1 :: Type -> Type) Source # | |
Defined in Generics.OneLiner.Internal | |
ks |- Profunctor => ADT_ nullary Identity ks (Rec1 f) (Rec1 f') Source # | |
Defined in Generics.OneLiner.Internal | |
(ks |- GenericProductProfunctor, ADT_ nullary unary ks f f', ADT_ nullary unary ks g g') => ADT_ nullary unary ks (f :*: g) (f' :*: g') Source # | |
Defined in Generics.OneLiner.Internal generic_ :: (Constraints' (f :*: g) (f' :*: g') c c1, Satisfies p ks) => Proxy c -> (forall s s'. c s s' => nullary (p s s')) -> Proxy c1 -> (forall (r1 :: Type -> Type) (s1 :: Type -> Type) d e. c1 r1 s1 => unary (p d e -> p (r1 d) (s1 e))) -> unary (p a b) -> p ((f :*: g) a) ((f' :*: g') b) Source # | |
(ks |- GenericSumProfunctor, ADT_ nullary unary ks f f', ADT_ nullary unary ks g g') => ADT_ nullary unary ks (f :+: g) (f' :+: g') Source # | |
Defined in Generics.OneLiner.Internal generic_ :: (Constraints' (f :+: g) (f' :+: g') c c1, Satisfies p ks) => Proxy c -> (forall s s'. c s s' => nullary (p s s')) -> Proxy c1 -> (forall (r1 :: Type -> Type) (s1 :: Type -> Type) d e. c1 r1 s1 => unary (p d e -> p (r1 d) (s1 e))) -> unary (p a b) -> p ((f :+: g) a) ((f' :+: g') b) Source # | |
ks |- Profunctor => ADT_ Identity unary ks (K1 i v :: Type -> Type) (K1 i' v' :: Type -> Type) Source # | |
Defined in Generics.OneLiner.Internal | |
(ks |- Profunctor, ADT_ nullary Identity ks g g') => ADT_ nullary Identity ks (f :.: g) (f' :.: g') Source # | |
Defined in Generics.OneLiner.Internal generic_ :: (Constraints' (f :.: g) (f' :.: g') c c1, Satisfies p ks) => Proxy c -> (forall s s'. c s s' => nullary (p s s')) -> Proxy c1 -> (forall (r1 :: Type -> Type) (s1 :: Type -> Type) d e. c1 r1 s1 => Identity (p d e -> p (r1 d) (s1 e))) -> Identity (p a b) -> p ((f :.: g) a) ((f' :.: g') b) Source # | |
(ks |- Profunctor, ADT_ nullary unary ks f f') => ADT_ nullary unary ks (M1 i c f) (M1 i' c' f') Source # | |
Defined in Generics.OneLiner.Internal generic_ :: (Constraints' (M1 i c f) (M1 i' c' f') c0 c1, Satisfies p ks) => Proxy c0 -> (forall s s'. c0 s s' => nullary (p s s')) -> Proxy c1 -> (forall (r1 :: Type -> Type) (s1 :: Type -> Type) d e. c1 r1 s1 => unary (p d e -> p (r1 d) (s1 e))) -> unary (p a b) -> p (M1 i c f a) (M1 i' c' f' b) Source # | |
ks |- GenericConstantProfunctor => ADT_ (Proxy :: Type -> Type) unary ks (K1 i v :: Type -> Type) (K1 i' v :: Type -> Type) Source # | |
Defined in Generics.OneLiner.Internal |
Instances
Profunctor (Ctor :: Type -> Type -> Type) Source # | |
GenericEmptyProfunctor (Ctor :: Type -> Type -> Type) Source # | |
GenericConstantProfunctor (Ctor :: Type -> Type -> Type) Source # | |
Defined in Generics.OneLiner.Internal | |
GenericSumProfunctor (Ctor :: Type -> Type -> Type) Source # | |
GenericProductProfunctor (Ctor :: Type -> Type -> Type) Source # | |
GenericUnitProfunctor (Ctor :: Type -> Type -> Type) Source # | |
record :: forall c p t t'. (ADTRecord t t', Constraints t t' c, GenericRecordProfunctor p) => (forall s s'. c s s' => p s s') -> p t t' Source #
record1 :: forall c p t t' a b. (ADTRecord1 t t', Constraints1 t t' c, GenericRecordProfunctor p) => (forall d e s s'. c s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
record01 :: forall c0 c1 p t t' a b. (ADTRecord1 t t', Constraints01 t t' c0 c1, GenericRecordProfunctor p) => (forall s s'. c0 s s' => p s s') -> (forall d e s s'. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
nonEmpty :: forall c p t t'. (ADTNonEmpty t t', Constraints t t' c, GenericNonEmptyProfunctor p) => (forall s s'. c s s' => p s s') -> p t t' Source #
nonEmpty1 :: forall c p t t' a b. (ADTNonEmpty1 t t', Constraints1 t t' c, GenericNonEmptyProfunctor p) => (forall d e s s'. c s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
nonEmpty01 :: forall c0 c1 p t t' a b. (ADTNonEmpty1 t t', Constraints01 t t' c0 c1, GenericNonEmptyProfunctor p) => (forall s s'. c0 s s' => p s s') -> (forall d e s s'. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
generic :: forall c p t t'. (ADT t t', Constraints t t' c, GenericProfunctor p) => (forall s s'. c s s' => p s s') -> p t t' Source #
generic1 :: forall c p t t' a b. (ADT1 t t', Constraints1 t t' c, Generic1Profunctor p) => (forall d e s s'. c s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
generic01 :: forall c0 c1 p t t' a b. (ADT1 t t', Constraints01 t t' c0 c1, GenericProfunctor p) => (forall s s'. c0 s s' => p s s') -> (forall d e s s'. c1 s s' => p d e -> p (s d) (s' e)) -> p a b -> p (t a) (t' b) Source #
type Constraints t t' c = Constraints' (Rep t) (Rep t') c AnyType Source #
Constraints
is a constraint type synonym, containing the constraint
requirements for an instance for t
of class c
.
It requires an instance of class c
for each component of t
.
type Constraints1 t t' c = Constraints' (Rep1 t) (Rep1 t') AnyType c Source #
type Constraints01 t t' c0 c1 = Constraints' (Rep1 t) (Rep1 t') c0 c1 Source #
type ADTRecord t t' = (Generic t, Generic t', ADTRecord' (Rep t) (Rep t'), Constraints t t' AnyType) Source #
type ADTRecord1 t t' = (Generic1 t, Generic1 t', ADTRecord1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType) Source #
type ADTNonEmpty t t' = (Generic t, Generic t', ADTNonEmpty' (Rep t) (Rep t'), Constraints t t' AnyType) Source #
ADTNonEmpty
is a constraint type synonym. An instance is an ADT
with *at least* one constructor.
type ADTNonEmpty1 t t' = (Generic1 t, Generic1 t', ADTNonEmpty1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType) Source #
type ADT1 t t' = (Generic1 t, Generic1 t', ADT1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType) Source #
Instances
AnyType (a :: k1) (b :: k2) Source # | |
Defined in Generics.OneLiner.Internal |
class FunConstraints c t where Source #
Automatically apply a lifted function to a polymorphic argument as many times as possible.
A constraint `FunConstraint c t` is equivalent to the conjunction of
constraints `c s` for every argument type of t
.
If r
is not a function type:
c a :- FunConstraints c (a -> r) (c a, c b) :- FunConstraints c (a -> b -> r) (c a, c b, c d) :- FunConstraints c (a -> b -> d -> r)
autoApply :: Applicative f => (forall s. c s => f s) -> f t -> f (FunResult t) Source #
Instances
FunResult r ~ r => FunConstraints c r Source # | |
Defined in Generics.OneLiner.Internal autoApply :: Applicative f => (forall s. c s => f s) -> f r -> f (FunResult r) Source # | |
(c a, FunConstraints c b) => FunConstraints c (a -> b) Source # | |
Defined in Generics.OneLiner.Internal autoApply :: Applicative f => (forall s. c s => f s) -> f (a -> b) -> f (FunResult (a -> b)) Source # |
Pair a a |