Safe Haskell | None |
---|---|
Language | Haskell2010 |
A class for witness types and lifting of constraints to the child nodes of a HyperType
Synopsis
- class HNodes (h :: HyperType) where
- type HNodesConstraint h (c :: HyperType -> Constraint) :: Constraint
- type HWitnessType h :: HyperType -> Type
- hLiftConstraint :: HNodesConstraint h c => HWitness h n -> Proxy c -> (c n => r) -> r
- newtype HWitness h n = HWitness (HWitnessType h n)
- _HWitness :: forall h n h n. Iso (HWitness h n) (HWitness h n) (HWitnessType h n) (HWitnessType h n)
- (#>) :: (HNodes h, HNodesConstraint h c) => Proxy c -> (c n => r) -> HWitness h n -> r
- (#*#) :: (HNodes h, HNodesConstraint h c) => Proxy c -> (c n => HWitness h n -> r) -> HWitness h n -> r
- class HNodesHaveConstraint c h where
- hNodesHaveConstraint :: proxy0 c -> proxy1 h -> Dict (HNodesConstraint h c)
Documentation
class HNodes (h :: HyperType) where Source #
HNodes
allows talking about the child nodes of a HyperType
.
Various classes like HFunctor
build upon HNodes
to provide methods such as hmap
which provide a rank-n function
for processing child nodes which requires a constraint on the nodes.
Nothing
type HNodesConstraint h (c :: HyperType -> Constraint) :: Constraint Source #
Lift a constraint to apply to the child nodes
type HNodesConstraint h c = HNodesConstraint (Rep1 h) c
type HWitnessType h :: HyperType -> Type Source #
HWitness h n
is a witness that n
is a node of h
.
A value quantified with forall n. HWitness h n -> ... n
,
is equivalent for a "for-some" where the possible values for n
are the nodes of h
.
type HWitnessType h = HWitnessType (Rep1 h)
hLiftConstraint :: HNodesConstraint h c => HWitness h n -> Proxy c -> (c n => r) -> r Source #
Lift a rank-n value with a constraint which the child nodes satisfy to a function from a node witness.
default hLiftConstraint :: (HWitnessType h ~ HWitnessType (Rep1 h), HNodesConstraint h c ~ HNodesConstraint (Rep1 h) c, HNodes (Rep1 h), HNodesConstraint h c) => HWitness h n -> Proxy c -> (c n => r) -> r Source #
Instances
HWitness (HWitnessType h n) |
_HWitness :: forall h n h n. Iso (HWitness h n) (HWitness h n) (HWitnessType h n) (HWitnessType h n) Source #
(#>) :: (HNodes h, HNodesConstraint h c) => Proxy c -> (c n => r) -> HWitness h n -> r infixr 0 Source #
Proxy
c #> r replaces the witness parameter of
r@ with a constraint on the witnessed node
(#*#) :: (HNodes h, HNodesConstraint h c) => Proxy c -> (c n => HWitness h n -> r) -> HWitness h n -> r infixr 0 Source #
A variant of #>
which does not consume the witness parameter.
Proxy
c0 Proxy c1 #> r
brings into context both the c0 n
and c1 n
constraints.
class HNodesHaveConstraint c h where Source #
Defunctionalized HNodesConstraint which can be curried
hNodesHaveConstraint :: proxy0 c -> proxy1 h -> Dict (HNodesConstraint h c) Source #
Instances
HNodesConstraint h c => HNodesHaveConstraint c h Source # | |
Defined in Hyper.Class.Nodes hNodesHaveConstraint :: proxy0 c -> proxy1 h -> Dict (HNodesConstraint h c) Source # |