one-liner-1.0: Constraint-based generics

LicenseBSD-style (see the file LICENSE)
Maintainersjoerd@w3future.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell98

Generics.OneLiner.Internal

Description

 
Synopsis

Documentation

type family Constraints' (t :: * -> *) (t' :: * -> *) (c :: * -> * -> Constraint) (c1 :: (* -> *) -> (* -> *) -> Constraint) :: Constraint #

Instances
type Constraints' Par1 Par1 c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' Par1 Par1 c c1 = ()
type Constraints' (V1 :: Type -> Type) (V1 :: Type -> Type) c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (V1 :: Type -> Type) (V1 :: Type -> Type) c c1 = ()
type Constraints' (U1 :: Type -> Type) (U1 :: Type -> Type) c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (U1 :: Type -> Type) (U1 :: Type -> Type) c c1 = ()
type Constraints' (Rec1 f) (Rec1 g) c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (Rec1 f) (Rec1 g) c c1 = c1 f g
type Constraints' (K1 i a :: Type -> Type) (K1 i' b :: Type -> Type) c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (K1 i a :: Type -> Type) (K1 i' b :: Type -> Type) c c1 = c a b
type Constraints' (f :+: g) (f' :+: g') c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (f :+: g) (f' :+: g') c c1 = (Constraints' f f' c c1, Constraints' g g' c c1)
type Constraints' (f :*: g) (f' :*: g') c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (f :*: g) (f' :*: g') c c1 = (Constraints' f f' c c1, Constraints' g g' c c1)
type Constraints' (M1 i t f) (M1 i' t' f') c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (M1 i t f) (M1 i' t' f') c c1 = Constraints' f f' c c1
type Constraints' (f :.: g) (f' :.: g') c c1 # 
Instance details

Defined in Generics.OneLiner.Internal

type Constraints' (f :.: g) (f' :.: g') c c1 = (c1 f f', Constraints' g g' c c1)

type family Satisfies (p :: * -> * -> *) (ks :: [(* -> * -> *) -> Constraint]) :: Constraint #

Instances
type Satisfies p ([] :: [(Type -> Type -> Type) -> Constraint]) # 
Instance details

Defined in Generics.OneLiner.Internal

type Satisfies p ([] :: [(Type -> Type -> Type) -> Constraint]) = ()
type Satisfies p (k ': ks) # 
Instance details

Defined in Generics.OneLiner.Internal

type Satisfies p (k ': ks) = (k p, Satisfies p ks)

class (ks :: [(* -> * -> *) -> Constraint]) |- (k :: (* -> * -> *) -> Constraint) where #

Methods

(|-) :: Satisfies p ks => proxy0 ks -> proxy1 k -> (k p => p a b) -> p a b #

Instances
(k ': _ks) |- k # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

(|-) :: Satisfies p (k ': _ks) => proxy0 (k ': _ks) -> proxy1 k -> (k p -> p a b) -> p a b #

ks |- k => (_k ': ks) |- k # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

(|-) :: Satisfies p (_k ': ks) => proxy0 (_k ': ks) -> proxy1 k -> (k p -> p a b) -> p a b #

generic' :: forall t t' c p ks a b proxy0 for. (ADT_ Identity Proxy ks t t', Constraints' t t' c AnyType, Satisfies p ks) => proxy0 ks -> for c -> (forall s s'. c s s' => p s s') -> p (t a) (t' b) #

generic1' :: forall t t' c1 p ks a b proxy0 for. (ADT_ Proxy Identity ks t t', Constraints' t t' AnyType c1, Satisfies p ks) => proxy0 ks -> for c1 -> (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 t t' c0 c1 p ks a b proxy0 for for1. (ADT_ Identity Identity ks t t', Constraints' t t' c0 c1, Satisfies p ks) => proxy0 ks -> for c0 -> (forall s s'. c0 s s' => p s s') -> for1 c1 -> (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 :: * -> *) (unary :: * -> *) (ks :: [(* -> * -> *) -> Constraint]) (t :: * -> *) (t' :: * -> *) where #

Methods

generic_ :: (Constraints' t t' c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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) #

Instances
ks |- Profunctor => ADT_ nullary Identity ks Par1 Par1 # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' Par1 Par1 c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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 (Par1 a) (Par1 b) #

ks |- GenericUnitProfunctor => ADT_ nullary unary ks (U1 :: Type -> Type) (U1 :: Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' U1 U1 c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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 (U1 a) (U1 b) #

ks |- GenericEmptyProfunctor => ADT_ nullary unary ks (V1 :: Type -> Type) (V1 :: Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' V1 V1 c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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 (V1 a) (V1 b) #

ks |- Profunctor => ADT_ nullary Identity ks (Rec1 f) (Rec1 f') # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' (Rec1 f) (Rec1 f') c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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 (Rec1 f a) (Rec1 f' b) #

(ks |- GenericProductProfunctor, ADT_ nullary unary ks f f', ADT_ nullary unary ks g g') => ADT_ nullary unary ks (f :*: g) (f' :*: g') # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' (f :*: g) (f' :*: g') c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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) #

(ks |- GenericSumProfunctor, ADT_ nullary unary ks f f', ADT_ nullary unary ks g g') => ADT_ nullary unary ks (f :+: g) (f' :+: g') # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' (f :+: g) (f' :+: g') c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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) #

ks |- Profunctor => ADT_ Identity unary ks (K1 i v :: Type -> Type) (K1 i' v' :: Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' (K1 i v) (K1 i' v') c c1, Satisfies p ks) => proxy0 ks -> proxy1 Identity -> for c -> (forall s s'. c s s' => Identity (p s s')) -> for1 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 (K1 i v a) (K1 i' v' b) #

(ks |- Profunctor, ADT_ nullary Identity ks g g') => ADT_ nullary Identity ks (f :.: g) (f' :.: g') # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' (f :.: g) (f' :.: g') c c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c -> (forall s s'. c s s' => nullary (p s s')) -> for1 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) #

(ks |- Profunctor, ADT_ nullary unary ks f f') => ADT_ nullary unary ks (M1 i c f) (M1 i' c' f') # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' (M1 i c f) (M1 i' c' f') c0 c1, Satisfies p ks) => proxy0 ks -> proxy1 nullary -> for c0 -> (forall s s'. c0 s s' => nullary (p s s')) -> for1 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) #

ks |- GenericEmptyProfunctor => ADT_ (Proxy :: Type -> Type) unary ks (K1 i v :: Type -> Type) (K1 i' v :: Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

generic_ :: (Constraints' (K1 i v) (K1 i' v) c c1, Satisfies p ks) => proxy0 ks -> proxy1 Proxy -> for c -> (forall s s'. c s s' => Proxy (p s s')) -> for1 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 (K1 i v a) (K1 i' v b) #

data Ctor a b #

Constructors

Ctor 

Fields

Instances
Profunctor (Ctor :: Type -> Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

dimap :: (a -> b) -> (c -> d) -> Ctor b c -> Ctor a d #

lmap :: (a -> b) -> Ctor b c -> Ctor a c #

rmap :: (b -> c) -> Ctor a b -> Ctor a c #

(#.) :: Coercible c b => q b c -> Ctor a b -> Ctor a c #

(.#) :: Coercible b a => Ctor b c -> q a b -> Ctor a c #

GenericEmptyProfunctor (Ctor :: Type -> Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

identity :: Ctor a a #

zero :: Ctor (V1 a) (V1 a') #

GenericSumProfunctor (Ctor :: Type -> Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

plus :: Ctor (f a) (f' a') -> Ctor (g a) (g' a') -> Ctor ((f :+: g) a) ((f' :+: g') a') #

GenericProductProfunctor (Ctor :: Type -> Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

mult :: Ctor (f a) (f' a') -> Ctor (g a) (g' a') -> Ctor ((f :*: g) a) ((f' :*: g') a') #

GenericUnitProfunctor (Ctor :: Type -> Type -> Type) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

unit :: Ctor (U1 a) (U1 a') #

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

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 #

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

ADTRecord is a constraint type synonym. An instance is an ADT with *exactly* one constructor.

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

ADTNonEmpty is a constraint type synonym. An instance is an ADT with *at least* one constructor.

type ADT t t' = (Generic t, Generic t', ADT' (Rep t) (Rep t'), Constraints t t' AnyType) #

ADT is a constraint type synonym. The Generic instance can be derived, and any generic representation will be an instance of ADT' and AnyType.

type ADT1 t t' = (Generic1 t, Generic1 t', ADT1' (Rep1 t) (Rep1 t'), Constraints1 t t' AnyType) #

class AnyType a b #

Instances
AnyType (a :: k2) (b :: k1) # 
Instance details

Defined in Generics.OneLiner.Internal

type family FunResult t where ... #

The result type of a curried function.

If r is not a function type (i.e., does not unify with `_ -> _`):

FunResult (a -> r) ~ r
FunResult (a -> b -> r) ~ r
FunResult (a -> b -> c -> r) ~ r

Equations

FunResult (a -> b) = FunResult b 
FunResult r = r 

class FunConstraints c t where #

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)

Methods

autoApply :: Applicative f => (forall s. c s => f s) -> f t -> f (FunResult t) #

Instances
FunResult r ~ r => FunConstraints c r # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

autoApply :: Applicative f => (forall s. c s => f s) -> f r -> f (FunResult r) #

(c a, FunConstraints c b) => FunConstraints c (a -> b) # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

autoApply :: Applicative f => (forall s. c s => f s) -> f (a -> b) -> f (FunResult (a -> b)) #

data Pair a #

Constructors

Pair a a 
Instances
Functor Pair # 
Instance details

Defined in Generics.OneLiner.Internal

Methods

fmap :: (a -> b) -> Pair a -> Pair b #

(<$) :: a -> Pair b -> Pair a #

(.:) :: (c -> d) -> (a -> b -> c) -> a -> b -> d infixr 9 #