barbies-2.0.1.0: Classes for working with types that can change clothes.

Safe HaskellNone
LanguageHaskell2010

Barbies.Internal

Contents

Synopsis

Functor

gbmapDefault :: CanDeriveFunctorB b f g => (forall a. f a -> g a) -> b f -> b g Source #

Default implementation of bmap based on Generic.

class GFunctor (n :: Nat) f g repbf repbg where Source #

Methods

gmap :: Proxy n -> (forall a. f a -> g a) -> repbf x -> repbg x Source #

Instances
GFunctor n (f :: k2 -> Type) (g :: k2 -> Type) (U1 :: k1 -> Type) (U1 :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: Proxy n -> (forall (a :: k). f a -> g a) -> U1 x -> U1 x Source #

GFunctor n (f :: k2 -> Type) (g :: k2 -> Type) (V1 :: k1 -> Type) (V1 :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: Proxy n -> (forall (a :: k). f a -> g a) -> V1 x -> V1 x Source #

GFunctor n (f :: k2 -> Type) (g :: k2 -> Type) (Rec x x :: k1 -> Type) (Rec x x :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: Proxy n -> (forall (a :: k). f a -> g a) -> Rec x x x0 -> Rec x x x0 Source #

(GFunctor n f g l l', GFunctor n f g r r') => GFunctor n (f :: k2 -> Type) (g :: k2 -> Type) (l :+: r :: k1 -> Type) (l' :+: r' :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: Proxy n -> (forall (a :: k). f a -> g a) -> (l :+: r) x -> (l' :+: r') x Source #

(GFunctor n f g l l', GFunctor n f g r r') => GFunctor n (f :: k2 -> Type) (g :: k2 -> Type) (l :*: r :: k1 -> Type) (l' :*: r' :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: Proxy n -> (forall (a :: k). f a -> g a) -> (l :*: r) x -> (l' :*: r') x Source #

GFunctor n f g bf bg => GFunctor n (f :: k2 -> Type) (g :: k2 -> Type) (M1 i c bf :: k1 -> Type) (M1 i c bg :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: Proxy n -> (forall (a :: k). f a -> g a) -> M1 i c bf x -> M1 i c bg x Source #

type CanDeriveFunctorB b f g = (GenericP 0 (b f), GenericP 0 (b g), GFunctor 0 f g (RepP 0 (b f)) (RepP 0 (b g))) Source #

CanDeriveFunctorB B f g is in practice a predicate about B only. Intuitively, it says that the following holds, for any arbitrary f:

  • There is an instance of Generic (B f).
  • B f can contain fields of type b f as long as there exists a FunctorB b instance. In particular, recursive usages of B f are allowed.
  • B f can also contain usages of b f under a Functor h. For example, one could use Maybe (B f) when defining B f.

type CanDeriveFunctorT t f g x = (GenericP 1 (t f x), GenericP 1 (t g x), GFunctor 1 f g (RepP 1 (t f x)) (RepP 1 (t g x))) Source #

CanDeriveFunctorT T f g x is in practice a predicate about T only. Intuitively, it says that the following holds, for any arbitrary f:

  • There is an instance of Generic (T f).
  • T f x can contain fields of type t f y as long as there exists a FunctorT t instance. In particular, recursive usages of T f y are allowed.
  • T f x can also contain usages of t f y under a Functor h. For example, one could use Maybe (T f y) when defining T f y.

Traversable

gbtraverseDefault :: forall b f g e. (Applicative e, CanDeriveTraversableB b f g) => (forall a. f a -> e (g a)) -> b f -> e (b g) Source #

Default implementation of btraverse based on Generic.

class GTraversable n f g repbf repbg where Source #

Methods

gtraverse :: Applicative t => Proxy n -> (forall a. f a -> t (g a)) -> repbf x -> t (repbg x) Source #

Instances
GTraversable (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (U1 :: k1 -> Type) (U1 :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: Applicative t => Proxy n -> (forall (a :: k). f a -> t (g a)) -> U1 x -> t (U1 x) Source #

GTraversable (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (V1 :: k1 -> Type) (V1 :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: Applicative t => Proxy n -> (forall (a :: k). f a -> t (g a)) -> V1 x -> t (V1 x) Source #

GTraversable (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (Rec a a :: k1 -> Type) (Rec a a :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: Applicative t => Proxy n -> (forall (a0 :: k). f a0 -> t (g a0)) -> Rec a a x -> t (Rec a a x) Source #

(GTraversable n f g l l', GTraversable n f g r r') => GTraversable (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (l :+: r :: k1 -> Type) (l' :+: r' :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: Applicative t => Proxy n -> (forall (a :: k). f a -> t (g a)) -> (l :+: r) x -> t ((l' :+: r') x) Source #

(GTraversable n f g l l', GTraversable n f g r r') => GTraversable (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (l :*: r :: k1 -> Type) (l' :*: r' :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: Applicative t => Proxy n -> (forall (a :: k). f a -> t (g a)) -> (l :*: r) x -> t ((l' :*: r') x) Source #

GTraversable n f g bf bg => GTraversable (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (M1 i c bf :: k1 -> Type) (M1 i c bg :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: Applicative t => Proxy n -> (forall (a :: k). f a -> t (g a)) -> M1 i c bf x -> t (M1 i c bg x) Source #

type CanDeriveTraversableB b f g = (GenericP 0 (b f), GenericP 0 (b g), GTraversable 0 f g (RepP 0 (b f)) (RepP 0 (b g))) Source #

CanDeriveTraversableB B f g is in practice a predicate about B only. It is analogous to CanDeriveFunctorB, so it essentially requires the following to hold, for any arbitrary f:

  • There is an instance of Generic (B f).
  • B f can contain fields of type b f as long as there exists a TraversableB b instance. In particular, recursive usages of B f are allowed.
  • B f can also contain usages of b f under a Traversable h. For example, one could use Maybe (B f) when defining B f.

type CanDeriveTraversableT t f g x = (GenericP 1 (t f x), GenericP 1 (t g x), GTraversable 1 f g (RepP 1 (t f x)) (RepP 1 (t g x))) Source #

CanDeriveTraversableT T f g x is in practice a predicate about T only. It is analogous to CanDeriveFunctorT, so it essentially requires the following to hold, for any arbitrary f:

  • There is an instance of Generic (T f x).
  • T f x can contain fields of type t f x as long as there exists a TraversableT t instance. In particular, recursive usages of T f x are allowed.
  • T f x can also contain usages of t f x under a Traversable h. For example, one could use Maybe (T f x) when defining T f x.

Distributive

gbdistributeDefault :: CanDeriveDistributiveB b f g => Functor f => f (b g) -> b (Compose f g) Source #

Default implementation of bdistribute based on Generic.

class Functor f => GDistributive (n :: Nat) f repbg repbfg where Source #

Methods

gdistribute :: Proxy n -> f (repbg x) -> repbfg x Source #

Instances
Functor f => GDistributive n f (U1 :: k -> Type) (U1 :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Distributive

Methods

gdistribute :: Proxy n -> f (U1 x) -> U1 x Source #

(GDistributive n f l l', GDistributive n f r r') => GDistributive n f (l :*: r :: k -> Type) (l' :*: r' :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Distributive

Methods

gdistribute :: Proxy n -> f ((l :*: r) x) -> (l' :*: r') x Source #

GDistributive n f bg bfg => GDistributive n f (M1 i c bg :: k -> Type) (M1 i c bfg :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Distributive

Methods

gdistribute :: Proxy n -> f (M1 i c bg x) -> M1 i c bfg x Source #

type CanDeriveDistributiveB b f g = (GenericP 0 (b g), GenericP 0 (b (Compose f g)), GDistributive 0 f (RepP 0 (b g)) (RepP 0 (b (Compose f g)))) Source #

CanDeriveDistributiveB B f g is in practice a predicate about B only. Intuitively, it says the the following holds for any arbitrary f:

  • There is an instance of Generic (B f).
  • (B f) has only one constructor, and doesn't contain "naked" fields (that is, not covered by f).
  • B f can contain fields of type b f as long as there exists a DistributiveB b instance. In particular, recursive usages of B f are allowed.
  • B f can also contain usages of b f under a Distributive h. For example, one could use a -> (B f) as a field of B f.

type CanDeriveDistributiveT (t :: (Type -> Type) -> i -> Type) f g x = (GenericP 1 (t g x), GenericP 1 (t (Compose f g) x), GDistributive 1 f (RepP 1 (t g x)) (RepP 1 (t (Compose f g) x))) Source #

CanDeriveDistributiveT T f g x is in practice a predicate about T only. Intuitively, it says the the following holds for any arbitrary f:

  • There is an instance of Generic (B f x).
  • (B f x) has only one constructor, and doesn't contain "naked" fields (that is, not covered by f). In particular, x needs to occur under f.
  • B f x can contain fields of type b f y as long as there exists a DistributiveT b instance. In particular, recursive usages of B f x are allowed.
  • B f x can also contain usages of b f y under a Distributive h. For example, one could use a -> (B f x) as a field of B f x.

Applicative

gbpureDefault :: forall b f. CanDeriveApplicativeB b f f => (forall a. f a) -> b f Source #

gbprodDefault :: forall b f g. CanDeriveApplicativeB b f g => b f -> b g -> b (f `Product` g) Source #

Default implementation of bprod based on Generic.

class GApplicative n (f :: k -> *) (g :: k -> *) repbf repbg repbfg where Source #

Methods

gprod :: Proxy n -> Proxy f -> Proxy g -> repbf x -> repbg x -> repbfg x Source #

gpure :: (f ~ g, repbf ~ repbg) => Proxy n -> Proxy f -> Proxy repbf -> Proxy repbfg -> (forall a. f a) -> repbf x Source #

Instances
GApplicative (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (U1 :: k1 -> Type) (U1 :: k1 -> Type) (U1 :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Applicative

Methods

gprod :: Proxy n -> Proxy f -> Proxy g -> U1 x -> U1 x -> U1 x Source #

gpure :: (f ~ g, U1 ~ U1) => Proxy n -> Proxy f -> Proxy U1 -> Proxy U1 -> (forall (a :: k). f a) -> U1 x Source #

Monoid x => GApplicative (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (Rec x x :: k1 -> Type) (Rec x x :: k1 -> Type) (Rec x x :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Applicative

Methods

gprod :: Proxy n -> Proxy f -> Proxy g -> Rec x x x0 -> Rec x x x0 -> Rec x x x0 Source #

gpure :: (f ~ g, Rec x x ~ Rec x x) => Proxy n -> Proxy f -> Proxy (Rec x x) -> Proxy (Rec x x) -> (forall (a :: k). f a) -> Rec x x x0 Source #

(GApplicative n f g lf lg lfg, GApplicative n f g rf rg rfg) => GApplicative (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (lf :*: rf :: k1 -> Type) (lg :*: rg :: k1 -> Type) (lfg :*: rfg :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Applicative

Methods

gprod :: Proxy n -> Proxy f -> Proxy g -> (lf :*: rf) x -> (lg :*: rg) x -> (lfg :*: rfg) x Source #

gpure :: (f ~ g, (lf :*: rf) ~ (lg :*: rg)) => Proxy n -> Proxy f -> Proxy (lf :*: rf) -> Proxy (lfg :*: rfg) -> (forall (a :: k). f a) -> (lf :*: rf) x Source #

GApplicative n f g repf repg repfg => GApplicative (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (M1 i c repf :: k1 -> Type) (M1 i c repg :: k1 -> Type) (M1 i c repfg :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Applicative

Methods

gprod :: Proxy n -> Proxy f -> Proxy g -> M1 i c repf x -> M1 i c repg x -> M1 i c repfg x Source #

gpure :: (f ~ g, M1 i c repf ~ M1 i c repg) => Proxy n -> Proxy f -> Proxy (M1 i c repf) -> Proxy (M1 i c repfg) -> (forall (a :: k). f a) -> M1 i c repf x Source #

type CanDeriveApplicativeB b f g = (GenericP 0 (b f), GenericP 0 (b g), GenericP 0 (b (f `Product` g)), GApplicative 0 f g (RepP 0 (b f)) (RepP 0 (b g)) (RepP 0 (b (f `Product` g)))) Source #

CanDeriveApplicativeB B f g is in practice a predicate about B only. Intuitively, it says that the following holds, for any arbitrary f:

  • There is an instance of Generic (B f).
  • B has only one constructor (that is, it is not a sum-type).
  • Every field of B f is either a monoid, or of the form f a, for some type a.

type CanDeriveApplicativeT t f g x = (GenericP 1 (t f x), GenericP 1 (t g x), GenericP 1 (t (f `Product` g) x), GApplicative 1 f g (RepP 1 (t f x)) (RepP 1 (t g x)) (RepP 1 (t (f `Product` g) x))) Source #

CanDeriveApplicativeT T f g x is in practice a predicate about T only. Intuitively, it says that the following holds, for any arbitrary f:

  • There is an instance of Generic (T f).
  • T has only one constructor (that is, it is not a sum-type).
  • Every field of T f x is either a monoid, or of the form f a, for some type a.

Constraints

gbaddDictsDefault :: forall b c f. (CanDeriveConstraintsB c b f, AllB c b) => b f -> b (Dict c `Product` f) Source #

Default implementation of baddDicts based on Generic.

class GConstraints n c f repbx repbf repbdf where Source #

Methods

gaddDicts :: GAll n c repbx => repbf x -> repbdf x Source #

Instances
GConstraints n (c :: k3 -> Constraint) (f :: k2) (U1 :: Type -> Type) (U1 :: k1 -> Type) (U1 :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: GAll n c U1 => U1 x -> U1 x Source #

GConstraints n (c :: k3 -> Constraint) (f :: k2) (V1 :: Type -> Type) (V1 :: k1 -> Type) (V1 :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: GAll n c V1 => V1 x -> V1 x Source #

GConstraints n (c :: k3 -> Constraint) (f :: k2) (Rec a' a :: Type -> Type) (Rec a a :: k1 -> Type) (Rec a a :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: GAll n c (Rec a' a) => Rec a a x -> Rec a a x Source #

(GConstraints n c f lx lf ldf, GConstraints n c f rx rf rdf) => GConstraints n (c :: k3 -> Constraint) (f :: k2) (lx :+: rx) (lf :+: rf :: k1 -> Type) (ldf :+: rdf :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: GAll n c (lx :+: rx) => (lf :+: rf) x -> (ldf :+: rdf) x Source #

(GConstraints n c f lx lf ldf, GConstraints n c f rx rf rdf) => GConstraints n (c :: k3 -> Constraint) (f :: k2) (lx :*: rx) (lf :*: rf :: k1 -> Type) (ldf :*: rdf :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: GAll n c (lx :*: rx) => (lf :*: rf) x -> (ldf :*: rdf) x Source #

GConstraints n c f repbx repbf repbdf => GConstraints n (c :: k3 -> Constraint) (f :: k2) (M1 i k4 repbx) (M1 i k4 repbf :: k1 -> Type) (M1 i k4 repbdf :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: GAll n c (M1 i k4 repbx) => M1 i k4 repbf x -> M1 i k4 repbdf x Source #

type CanDeriveConstraintsB c b f = (GenericP 0 (b f), GenericP 0 (b (Dict c `Product` f)), AllB c b ~ GAll 0 c (GAllRepB b), GConstraints 0 c f (GAllRepB b) (RepP 0 (b f)) (RepP 0 (b (Dict c `Product` f)))) Source #

CanDeriveConstraintsB B f g is in practice a predicate about B only. Intuitively, it says that the following holds, for any arbitrary f:

  • There is an instance of Generic (B f).
  • B f can contain fields of type b f as long as there exists a ConstraintsB b instance. In particular, recursive usages of B f are allowed.

type CanDeriveConstraintsT c t f x = (GenericP 1 (t f x), GenericP 1 (t (Dict c `Product` f) x), AllT c t ~ GAll 1 c (GAllRepT t), GConstraints 1 c f (GAllRepT t) (RepP 1 (t f x)) (RepP 1 (t (Dict c `Product` f) x))) Source #

CanDeriveConstraintsT T f g x is in practice a predicate about T only. Intuitively, it says that the following holds, for any arbitrary f and x:

  • There is an instance of Generic (T f x).
  • T f can contain fields of type t f x as long as there exists a ConstraintsT t instance. In particular, recursive usages of T f x are allowed.

type family GAll (n :: Nat) (c :: k -> Constraint) (repbf :: Type -> Type) :: Constraint Source #

Instances
type GAll n (c :: k -> Constraint) (U1 :: Type -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (U1 :: Type -> Type) = ()
type GAll n (c :: k -> Constraint) (V1 :: Type -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (V1 :: Type -> Type) = ()
type GAll n (c :: k -> Constraint) (Rec a a :: Type -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (Rec a a :: Type -> Type) = ()
type GAll n (c :: k -> Constraint) (l :+: r) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (l :+: r) = (GAll n c l, GAll n c r)
type GAll n (c :: k -> Constraint) (l :*: r) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (l :*: r) = (GAll n c l, GAll n c r)
type GAll n (c :: k1 -> Constraint) (M1 i k2 repbf) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k1 -> Constraint) (M1 i k2 repbf) = GAll n c repbf

type GAllRepB b = TagSelf 0 b (RepN (b X)) Source #

The representation used for the generic computation of the AllB c b constraints. Here X is an arbitrary constant since the actual argument to b is irrelevant.

type GAllRepT t = TagSelf 1 t (RepN (t X Y)) Source #

The representation used for the generic computation of the AllT c t constraints. Here X and Y are arbitrary constants since the actual argument to t is irrelevant.

data X a Source #

data family Y :: k Source #

type TagSelf n b repbf = TagSelf' n b (Indexed b (n + 1)) repbf Source #

We use the type-families to generically compute AllB c b. Intuitively, if b' f occurs inside b f, then we should just add AllB b' c to AllB b c. The problem is that if b is a recursive type, and b' is b, then ghc will choke and blow the stack (instead of computing a fixpoint).

So, we would like to behave differently when b = b' and add () instead of AllB b f to break the recursion. Our trick will be to use a type family to inspect RepN (b f) and distinguish recursive usages from non-recursive ones, tagging them with different types, so we can distinguish them in the instances.

type family TagSelf' (n :: Nat) (b :: kb) (b' :: kb) (repbf :: * -> *) :: * -> * where ... Source #

Equations

TagSelf' n b b' (M1 mt m s) = M1 mt m (TagSelf' n b b' s) 
TagSelf' n b b' (l :+: r) = TagSelf' n b b' l :+: TagSelf' n b b' r 
TagSelf' n b b' (l :*: r) = TagSelf' n b b' l :*: TagSelf' n b b' r 
TagSelf' 0 b b' (Rec (b' f) (b g)) = Rec (Self b' f) (b g) 
TagSelf' 0 (b :: k -> *) b' (Rec ((b'' :: k -> *) f) ((b''' :: k -> *) g)) = Rec (Other b'' f) (b''' g) 
TagSelf' 1 b b' (Rec (b' fl fr) (b gl gr)) = Rec (Self b' fl fr) (b gl gr) 
TagSelf' 1 (b :: kl -> kr -> *) b' (Rec ((b'' :: kl -> kr -> *) fl fr) ((b''' :: kl -> kr -> *) gl gr)) = Rec (Other b'' fl fr) (b''' gl gr) 
TagSelf' n b b' (Rec p a) = Rec p a 
TagSelf' n b b' U1 = U1 
TagSelf' n b b' V1 = V1 

data family Self (b :: k -> k') :: k -> k' Source #

data family Other (b :: k -> k') :: k -> k' Source #

Bare values

gbcoverDefault :: CanDeriveBareB b => b Bare Identity -> b Covered Identity Source #

Default implementation of bstrip based on Generic.

gbstripDefault :: CanDeriveBareB b => b Covered Identity -> b Bare Identity Source #

Default implementation of bstrip based on Generic.

class GBare (n :: Nat) repbi repbb where Source #

Methods

gstrip :: Proxy n -> repbi x -> repbb x Source #

gcover :: Proxy n -> repbb x -> repbi x Source #

Instances
GBare n (U1 :: k -> Type) (U1 :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Bare

Methods

gstrip :: Proxy n -> U1 x -> U1 x Source #

gcover :: Proxy n -> U1 x -> U1 x Source #

GBare n (V1 :: k -> Type) (V1 :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Bare

Methods

gstrip :: Proxy n -> V1 x -> V1 x Source #

gcover :: Proxy n -> V1 x -> V1 x Source #

repbi ~ repbb => GBare n (Rec repbi repbi :: k -> Type) (Rec repbb repbb :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Bare

Methods

gstrip :: Proxy n -> Rec repbi repbi x -> Rec repbb repbb x Source #

gcover :: Proxy n -> Rec repbb repbb x -> Rec repbi repbi x Source #

(GBare n l l', GBare n r r') => GBare n (l :+: r :: k -> Type) (l' :+: r' :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Bare

Methods

gstrip :: Proxy n -> (l :+: r) x -> (l' :+: r') x Source #

gcover :: Proxy n -> (l' :+: r') x -> (l :+: r) x Source #

(GBare n l l', GBare n r r') => GBare n (l :*: r :: k -> Type) (l' :*: r' :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Bare

Methods

gstrip :: Proxy n -> (l :*: r) x -> (l' :*: r') x Source #

gcover :: Proxy n -> (l' :*: r') x -> (l :*: r) x Source #

GBare n repbi repbb => GBare n (M1 i k2 repbi :: k1 -> Type) (M1 i k2 repbb :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Bare

Methods

gstrip :: Proxy n -> M1 i k2 repbi x -> M1 i k2 repbb x Source #

gcover :: Proxy n -> M1 i k2 repbb x -> M1 i k2 repbi x Source #

type CanDeriveBareB b = (GenericP 0 (b Bare Identity), GenericP 0 (b Covered Identity), GBare 0 (RepP 0 (b Covered Identity)) (RepP 0 (b Bare Identity))) Source #

All types that admit a generic FunctorB instance, and have all their occurrences of f under a Wear admit a generic BareB instance.

Generic derivation support

data family Param (n :: Nat) (a :: k) :: k Source #

type family Indexed (t :: k) (i :: Nat) :: k where ... Source #

Equations

Indexed (t a) i = Indexed t (i + 1) (Param i a) 
Indexed t _ = t 

type family FilterIndex (n :: Nat) (t :: k) :: k where ... Source #

Equations

FilterIndex n (t (Param n a)) = FilterIndex n t (Param n a) 
FilterIndex n (t (Param _ a)) = FilterIndex n t a 
FilterIndex _ t = t 

type family Zip (a :: Type -> Type) (b :: Type -> Type) :: Type -> Type where ... Source #

Equations

Zip (M1 mt m s) (M1 mt m t) = M1 mt m (Zip s t) 
Zip (l :+: r) (l' :+: r') = Zip l l' :+: Zip r r' 
Zip (l :*: r) (l' :*: r') = Zip l l' :*: Zip r r' 
Zip (Rec0 p) (Rec0 a) = Rec p a 
Zip U1 U1 = U1 
Zip V1 V1 = V1 

newtype Rec (p :: Type) a x Source #

Constructors

Rec 

Fields

Instances
GTraversable (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (Rec a a :: k1 -> Type) (Rec a a :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: Applicative t => Proxy n -> (forall (a0 :: k). f a0 -> t (g a0)) -> Rec a a x -> t (Rec a a x) Source #

GConstraints n (c :: k3 -> Constraint) (f :: k2) (Rec a' a :: Type -> Type) (Rec a a :: k1 -> Type) (Rec a a :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: GAll n c (Rec a' a) => Rec a a x -> Rec a a x Source #

Monoid x => GApplicative (n :: k3) (f :: k2 -> Type) (g :: k2 -> Type) (Rec x x :: k1 -> Type) (Rec x x :: k1 -> Type) (Rec x x :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Applicative

Methods

gprod :: Proxy n -> Proxy f -> Proxy g -> Rec x x x0 -> Rec x x x0 -> Rec x x x0 Source #

gpure :: (f ~ g, Rec x x ~ Rec x x) => Proxy n -> Proxy f -> Proxy (Rec x x) -> Proxy (Rec x x) -> (forall (a :: k). f a) -> Rec x x x0 Source #

GFunctor n (f :: k2 -> Type) (g :: k2 -> Type) (Rec x x :: k1 -> Type) (Rec x x :: k1 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: Proxy n -> (forall (a :: k). f a -> g a) -> Rec x x x0 -> Rec x x x0 Source #

repbi ~ repbb => GBare n (Rec repbi repbi :: k -> Type) (Rec repbb repbb :: k -> Type) Source # 
Instance details

Defined in Barbies.Generics.Bare

Methods

gstrip :: Proxy n -> Rec repbi repbi x -> Rec repbb repbb x Source #

gcover :: Proxy n -> Rec repbb repbb x -> Rec repbi repbi x Source #

type GAll n (c :: k -> Constraint) (Rec a a :: Type -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (Rec a a :: Type -> Type) = ()

class (Coercible (Rep a) (RepN a), Generic a) => GenericN (a :: Type) where Source #

Associated Types

type RepN (a :: Type) :: Type -> Type Source #

Methods

toN :: RepN a x -> a Source #

fromN :: a -> RepN a x Source #

Instances
(Coercible (Rep a) (RepN a), Generic a) => GenericN a Source # 
Instance details

Defined in Data.Generics.GenericN

Associated Types

type RepN a :: Type -> Type Source #

Methods

toN :: RepN a x -> a Source #

fromN :: a -> RepN a x Source #

class (Coercible (Rep a) (RepP n a), Generic a) => GenericP (n :: Nat) (a :: Type) where Source #

Associated Types

type RepP n a :: Type -> Type Source #

Methods

toP :: Proxy n -> RepP n a x -> a Source #

fromP :: Proxy n -> a -> RepP n a x Source #

Instances
(Coercible (Rep a) (RepP n a), Generic a) => GenericP n a Source # 
Instance details

Defined in Data.Generics.GenericN

Associated Types

type RepP n a :: Type -> Type Source #

Methods

toP :: Proxy n -> RepP n a x -> a Source #

fromP :: Proxy n -> a -> RepP n a x Source #