barbies-2.0.5.0: Classes for working with types that can change clothes.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Barbies.Internal

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

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

Defined in Barbies.Generics.Functor

Methods

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

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

Defined in Barbies.Generics.Functor

Methods

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

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

Defined in Barbies.Generics.Functor

Methods

gmap :: forall (x0 :: k10). 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 :: k1 -> Type) (g :: k1 -> Type) (l :*: r :: k2 -> Type) (l' :*: r' :: k2 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: forall (x :: k10). 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 :: k1 -> Type) (g :: k1 -> Type) (l :+: r :: k2 -> Type) (l' :+: r' :: k2 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: forall (x :: k10). 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 :: k1 -> Type) (g :: k1 -> Type) (M1 i c bf :: k2 -> Type) (M1 i c bg :: k2 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Functor

Methods

gmap :: forall (x :: k10). 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

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

Defined in Barbies.Generics.Traversable

Methods

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

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

Defined in Barbies.Generics.Traversable

Methods

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

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

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: forall t (x :: k20). Applicative t => Proxy n -> (forall (a0 :: k10). 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 :: k1) (f :: k2 -> Type) (g :: k2 -> Type) (l :*: r :: k3 -> Type) (l' :*: r' :: k3 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: forall t (x :: k20). Applicative t => Proxy n -> (forall (a :: k10). 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 :: k1) (f :: k2 -> Type) (g :: k2 -> Type) (l :+: r :: k3 -> Type) (l' :+: r' :: k3 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Traversable

Methods

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

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

Defined in Barbies.Generics.Traversable

Methods

gtraverse :: forall t (x :: k20). Applicative t => Proxy n -> (forall (a :: k10). 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

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

Defined in Barbies.Generics.Distributive

Methods

gdistribute :: forall (x :: k0). 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 :: forall (x :: k0). 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 :: forall (x :: k0). 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 -> Type) (g :: k -> Type) 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

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

Defined in Barbies.Generics.Applicative

Methods

gprod :: forall (x :: k10). Proxy n -> Proxy f -> Proxy g -> U1 x -> U1 x -> U1 x Source #

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

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

Defined in Barbies.Generics.Applicative

Methods

gprod :: forall (x0 :: k10). Proxy n -> Proxy f -> Proxy g -> Rec x x x0 -> Rec x x x0 -> Rec x x x0 Source #

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

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

Defined in Barbies.Generics.Applicative

Methods

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

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

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

Defined in Barbies.Generics.Applicative

Methods

gprod :: forall (x :: k10). Proxy n -> Proxy f -> Proxy g -> M1 i c repf x -> M1 i c repg x -> M1 i c repfg x Source #

gpure :: forall (x :: k10). (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 :: k20). 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

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

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: forall (x :: k20). GAll n c U1 => U1 x -> U1 x Source #

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

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: forall (x :: k20). GAll n c V1 => V1 x -> V1 x Source #

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

Defined in Barbies.Generics.Constraints

Methods

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

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

Defined in Barbies.Generics.Constraints

Methods

gaddDicts :: forall (x :: k20). 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 :: k1 -> Constraint) (f :: k2) (lx :+: rx) (lf :+: rf :: k3 -> Type) (ldf :+: rdf :: k3 -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

Methods

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

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

Defined in Barbies.Generics.Constraints

Methods

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

type CanDeriveConstraintsB c b f = (GenericN (b f), GenericN (b (Dict c `Product` f)), AllB c b ~ GAll 0 c (GAllRepB b), GConstraints 0 c f (GAllRepB b) (RepN (b f)) (RepN (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 = (GenericN (t f x), GenericN (t (Dict c `Product` f) x), AllT c t ~ GAll 1 c (GAllRepT t), GConstraints 1 c f (GAllRepT t) (RepN (t f x)) (RepN (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

Instances details
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 l r :: Type -> Type) Source # 
Instance details

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (Rec l r :: 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 = TagSelf0 b Source #

The representation used for the generic computation of the AllB c b constraints.

type GAllRepT t = TagSelf1 t Source #

The representation used for the generic computation of the AllT c t constraints. .

data X a Source #

data family Y :: k Source #

data Self (p :: Type) (a :: Type) (x :: Type) Source #

data Other (p :: Type) (a :: Type) (x :: Type) Source #

type family SelfOrOther (b :: k) (b' :: k) :: Type -> Type -> Type -> Type where ... Source #

Equations

SelfOrOther b b = Self 
SelfOrOther b b' = Other 

type TagSelf0 b = TagSelf0' (Indexed b 1) (RepN (b X)) 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 c to break the recursion. Our trick will be to use a type family to inspect Rep (b X), for an arbitrary X, and distinguish recursive usages from non-recursive ones, tagging them with different types, so we can distinguish them in the instances.

type family TagSelf0' (b :: kf -> Type) (repbf :: Type -> Type) :: Type -> Type where ... Source #

Equations

TagSelf0' b (M1 mt m s) = M1 mt m (TagSelf0' b s) 
TagSelf0' b (l :+: r) = TagSelf0' b l :+: TagSelf0' b r 
TagSelf0' b (l :*: r) = TagSelf0' b l :*: TagSelf0' b r 
TagSelf0' (b :: kf -> Type) (Rec ((b' :: kf -> Type) f) ((b'' :: kf -> Type) g)) = SelfOrOther b b' (b' f) (b'' g) 
TagSelf0' b (Rec x y) = Rec x y 
TagSelf0' b U1 = U1 
TagSelf0' b V1 = V1 

type TagSelf1 b = TagSelf1' (Indexed b 2) (Zip (Rep (Indexed (b X) 1 Y)) (Rep (b X Y))) Source #

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

So, we would like to behave differently when t = t' and add () instead of AllT t c to break the recursion. Our trick will be to use a type family to inspect Rep (t X Y), for arbitrary X and Y and distinguish recursive usages from non-recursive ones, tagging them with different types, so we can distinguish them in the instances.

type family TagSelf1' (b :: kf -> kg -> Type) (repbf :: Type -> Type) :: Type -> Type where ... Source #

Equations

TagSelf1' b (M1 mt m s) = M1 mt m (TagSelf1' b s) 
TagSelf1' b (l :+: r) = TagSelf1' b l :+: TagSelf1' b r 
TagSelf1' b (l :*: r) = TagSelf1' b l :*: TagSelf1' b r 
TagSelf1' (b :: kf -> kg -> Type) (Rec ((b' :: kf -> kg -> Type) fl fr) ((b'' :: kf -> kg -> Type) gl gr)) = SelfOrOther b b' (b' fl gr) (b'' gl gr) 
TagSelf1' b (Rec x y) = Rec x y 
TagSelf1' b U1 = U1 
TagSelf1' b V1 = V1 

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

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

Defined in Barbies.Generics.Bare

Methods

gstrip :: forall (x :: k0). Proxy n -> U1 x -> U1 x Source #

gcover :: forall (x :: k0). 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 :: forall (x :: k0). Proxy n -> V1 x -> V1 x Source #

gcover :: forall (x :: k0). 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 :: forall (x :: k0). Proxy n -> Rec repbi repbi x -> Rec repbb repbb x Source #

gcover :: forall (x :: k0). 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 :: forall (x :: k0). Proxy n -> (l :*: r) x -> (l' :*: r') x Source #

gcover :: forall (x :: k0). 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 :: forall (x :: k0). Proxy n -> (l :+: r) x -> (l' :+: r') x Source #

gcover :: forall (x :: k0). 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 :: forall (x :: k). Proxy n -> M1 i k2 repbi x -> M1 i k2 repbb x Source #

gcover :: forall (x :: k). 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

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

Defined in Barbies.Generics.Traversable

Methods

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

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

Defined in Barbies.Generics.Applicative

Methods

gprod :: forall (x0 :: k10). Proxy n -> Proxy f -> Proxy g -> Rec x x x0 -> Rec x x x0 -> Rec x x x0 Source #

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

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

Defined in Barbies.Generics.Constraints

Methods

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

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

Defined in Barbies.Generics.Functor

Methods

gmap :: forall (x0 :: k10). 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 :: forall (x :: k0). Proxy n -> Rec repbi repbi x -> Rec repbb repbb x Source #

gcover :: forall (x :: k0). Proxy n -> Rec repbb repbb x -> Rec repbi repbi x Source #

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

Defined in Barbies.Generics.Constraints

type GAll n (c :: k -> Constraint) (Rec l r :: Type -> Type)

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

Associated Types

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

type RepN a = Zip (Rep (Indexed a 0)) (Rep a)

Methods

toN :: RepN a x -> a Source #

fromN :: a -> RepN a x Source #

Instances

Instances details
(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 #

type RepP n a = Zip (Rep (FilterIndex n (Indexed a 0))) (Rep a)

Methods

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

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

Instances

Instances details
(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 #