Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Generic.Data.FOnCstr
Synopsis
- class GenericFOnCstr tag where
- type GenericFOnCstrF tag :: Type -> Type
- type GenericFOnCstrC tag (dtName :: Symbol) (cstrName :: Symbol) (gf :: k -> Type) :: Constraint
- genericFOnCstrF :: GenericFOnCstrC tag dtName cstrName gf => Proxy# '(dtName, cstrName) -> GenericFOnCstrF tag (gf p)
- class GFOnCstr tag (name :: Symbol) gf where
- gFOnCstr :: GenericFOnCstrF tag (gf p)
- type family AssertValidCstrPath dtName cstr eae where ...
- class GFOnCstr' tag (dtName :: Symbol) (cstrName :: Symbol) (turns :: [GCstrChoice]) gf where
- gFOnCstr' :: GenericFOnCstrF tag (gf p)
- genericFOnCstr :: forall tag (name :: Symbol) a. (Generic a, Functor (GenericFOnCstrF tag), GFOnCstr tag name (Rep a)) => GenericFOnCstrF tag a
Documentation
class GenericFOnCstr tag where Source #
What generic functor to run on the requested constructor.
Associated Types
type GenericFOnCstrF tag :: Type -> Type Source #
Functor.
type GenericFOnCstrC tag (dtName :: Symbol) (cstrName :: Symbol) (gf :: k -> Type) :: Constraint Source #
Constraint. Includes relevant generic meta (data type & constructor name).
Methods
genericFOnCstrF :: GenericFOnCstrC tag dtName cstrName gf => Proxy# '(dtName, cstrName) -> GenericFOnCstrF tag (gf p) Source #
Generic functor.
We have to pass a proxy thanks to type applications not working properly with instances. (This will be easier in GHC 9.10 via RequiredTypeArguments).
class GFOnCstr tag (name :: Symbol) gf where Source #
Run a generic functor (provided via tag
) on the constructor name name
.
We hope and pray that GHC removes the generic wrappers, at least the constructor ones, since we do a whole bunch of nothing with them on the term level. Checking this (the produced Core) is a big TODO.
Methods
gFOnCstr :: GenericFOnCstrF tag (gf p) Source #
Instances
(turns ~ AssertValidCstrPath dtName cstrName (GCstrPath cstrName gf), Functor (GenericFOnCstrF tag), GFOnCstr' tag dtName cstrName turns gf) => GFOnCstr (tag :: k2) cstrName (D1 ('MetaData dtName _md2 _md3 _md4) gf :: k1 -> Type) Source # | |
Defined in Generic.Data.FOnCstr |
type family AssertValidCstrPath dtName cstr eae where ... Source #
class GFOnCstr' tag (dtName :: Symbol) (cstrName :: Symbol) (turns :: [GCstrChoice]) gf where Source #
Methods
gFOnCstr' :: GenericFOnCstrF tag (gf p) Source #
Instances
(Functor (GenericFOnCstrF tag), GenericFOnCstr tag, GenericFOnCstrC tag dtName cstrName gf) => GFOnCstr' (tag :: k1) dtName cstrName ('[] :: [GCstrChoice]) (C1 mc gf :: k2 -> Type) Source # | |
Defined in Generic.Data.FOnCstr Methods gFOnCstr' :: forall (p :: k10). GenericFOnCstrF tag (C1 mc gf p) Source # | |
(Functor (GenericFOnCstrF tag), GFOnCstr' tag dtName cstrName turns l) => GFOnCstr' (tag :: k1) dtName cstrName ('GoL1 ': turns) (l :+: r :: k2 -> Type) Source # | |
Defined in Generic.Data.FOnCstr Methods gFOnCstr' :: forall (p :: k10). GenericFOnCstrF tag ((l :+: r) p) Source # | |
(Functor (GenericFOnCstrF tag), GFOnCstr' tag dtName cstrName turns r) => GFOnCstr' (tag :: k1) dtName cstrName ('GoR1 ': turns) (l :+: r :: k2 -> Type) Source # | |
Defined in Generic.Data.FOnCstr Methods gFOnCstr' :: forall (p :: k10). GenericFOnCstrF tag ((l :+: r) p) Source # |
genericFOnCstr :: forall tag (name :: Symbol) a. (Generic a, Functor (GenericFOnCstrF tag), GFOnCstr tag name (Rep a)) => GenericFOnCstrF tag a Source #
Run a generic functor on the requested constructor of the given type.