Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class KFunctor (f :: k) (v :: Variances) (as :: LoT k) (bs :: LoT k) | f -> v where
- kmapo :: forall {k} (f :: k) (v :: Variances) (as :: LoT k) (bs :: LoT k). KFunctor f v as bs => Mappings v as bs -> (f :@@: as) -> f :@@: bs
- data Variance
- type Variances = [Variance]
- type family Mapping (v :: Variance) a b where ...
- data Mappings (v :: Variances) (x :: LoT k) (y :: LoT k) where
Documentation
class KFunctor (f :: k) (v :: Variances) (as :: LoT k) (bs :: LoT k) | f -> v where Source #
Declares that the type constructor f
is a generalized
functor whose variances for each type argument are given by v
.
kmapo :: forall {k} (f :: k) (v :: Variances) (as :: LoT k) (bs :: LoT k). KFunctor f v as bs => Mappings v as bs -> (f :@@: as) -> f :@@: bs Source #
The generalized version of fmap
, bimap
, dimap
, and so on.
This version uses Split
to obtain better type inference.
Mappings of different variance
Possible variances for each argument of a type constructor.
type family Mapping (v :: Variance) a b where ... Source #
If a KFunctor
needs to map an f ... a ...
to an f ... b ...
,
a Mapping v a b
specifies which function needs to be provided
for that position depending on its variance v
.