| Safe Haskell | Safe |
|---|---|
| Language | Haskell2010 |
Generics.SOP.BasicFunctors
Contents
Description
Basic functors.
Definitions of the type-level equivalents of
const, id, and (.), and a definition of
the lifted function space.
These datatypes are generally useful, but in this
library, they're primarily used as parameters for
the NP, NS, POP, and SOP types.
We define own variants of Const,
Identity and Compose for
various reasons.
ConstandComposebecome kind polymorphic only inbase-4.9.0.0(transformers-0.5.0.0).- Shorter names are convenient, and pattern synonyms aren't (yet) powerful enough, particularly exhaustiveness check doesn't work properly. See https://ghc.haskell.org/trac/ghc/ticket/8779.
- newtype K a b = K a
- unK :: K a b -> a
- newtype I a = I a
- unI :: I a -> a
- newtype (f :.: g) p = Comp (f (g p))
- unComp :: (f :.: g) p -> f (g p)
- mapII :: (a -> b) -> I a -> I b
- mapIK :: (a -> b) -> I a -> K b c
- mapKI :: (a -> b) -> K a c -> I b
- mapKK :: (a -> b) -> K a c -> K b d
- mapIII :: (a -> b -> c) -> I a -> I b -> I c
- mapIIK :: (a -> b -> c) -> I a -> I b -> K c d
- mapIKI :: (a -> b -> c) -> I a -> K b d -> I c
- mapIKK :: (a -> b -> c) -> I a -> K b d -> K c e
- mapKII :: (a -> b -> c) -> K a d -> I b -> I c
- mapKIK :: (a -> b -> c) -> K a d -> I b -> K c e
- mapKKI :: (a -> b -> c) -> K a d -> K b e -> I c
- mapKKK :: (a -> b -> c) -> K a d -> K b e -> K c f
Basic functors
The constant type functor.
Like Constant, but kind-polymorphic
in its second argument and with a shorter name.
Constructors
| K a |
Instances
| Eq2 (K *) Source # | Since: 0.2.4.0 |
| Ord2 (K *) Source # | Since: 0.2.4.0 |
| Read2 (K *) Source # | Since: 0.2.4.0 |
| Show2 (K *) Source # | Since: 0.2.4.0 |
| Functor (K * a) Source # | |
| Monoid a => Applicative (K * a) Source # | |
| Foldable (K * a) Source # | |
| Traversable (K * a) Source # | |
| Eq a => Eq1 (K * a) Source # | Since: 0.2.4.0 |
| Ord a => Ord1 (K * a) Source # | Since: 0.2.4.0 |
| Read a => Read1 (K * a) Source # | Since: 0.2.4.0 |
| Show a => Show1 (K * a) Source # | Since: 0.2.4.0 |
| Eq a => Eq (K k a b) Source # | |
| Ord a => Ord (K k a b) Source # | |
| Read a => Read (K k a b) Source # | |
| Show a => Show (K k a b) Source # | |
| Generic (K k a b) Source # | |
| NFData a => NFData (K k a b) Source # | Since: 0.2.5.0 |
| type Rep (K k a b) Source # | |
| type Code (K * a0 b0) Source # | |
The identity type functor.
Like Identity, but with a shorter name.
Constructors
| I a |
Instances
| Monad I Source # | |
| Functor I Source # | |
| Applicative I Source # | |
| Foldable I Source # | |
| Traversable I Source # | |
| Eq1 I Source # | Since: 0.2.4.0 |
| Ord1 I Source # | Since: 0.2.4.0 |
| Read1 I Source # | Since: 0.2.4.0 |
| Show1 I Source # | Since: 0.2.4.0 |
| Eq a => Eq (I a) Source # | |
| Ord a => Ord (I a) Source # | |
| Read a => Read (I a) Source # | |
| Show a => Show (I a) Source # | |
| Generic (I a) Source # | |
| NFData a => NFData (I a) Source # | Since: 0.2.5.0 |
| type Rep (I a) Source # | |
| type Code (I a0) Source # | |
newtype (f :.: g) p infixr 7 Source #
Composition of functors.
Like Compose, but kind-polymorphic
and with a shorter name.
Constructors
| Comp (f (g p)) |
Instances
| (Functor f, Functor g) => Functor ((:.:) * * f g) Source # | |
| (Applicative f, Applicative g) => Applicative ((:.:) * * f g) Source # | Since: 0.2.5.0 |
| (Foldable f, Foldable g) => Foldable ((:.:) * * f g) Source # | Since: 0.2.5.0 |
| (Traversable f, Traversable g) => Traversable ((:.:) * * f g) Source # | Since: 0.2.5.0 |
| (Eq1 f, Eq1 g) => Eq1 ((:.:) * * f g) Source # | Since: 0.2.4.0 |
| (Ord1 f, Ord1 g) => Ord1 ((:.:) * * f g) Source # | Since: 0.2.4.0 |
| (Read1 f, Read1 g) => Read1 ((:.:) * * f g) Source # | Since: 0.2.4.0 |
| (Show1 f, Show1 g) => Show1 ((:.:) * * f g) Source # | Since: 0.2.4.0 |
| (Eq1 f, Eq1 g, Eq a) => Eq ((:.:) * * f g a) Source # | |
| (Ord1 f, Ord1 g, Ord a) => Ord ((:.:) * * f g a) Source # | |
| (Read1 f, Read1 g, Read a) => Read ((:.:) * * f g a) Source # | |
| (Show1 f, Show1 g, Show a) => Show ((:.:) * * f g a) Source # | |
| Generic ((:.:) k l f g p) Source # | |
| NFData (f (g a)) => NFData ((:.:) k l f g a) Source # | Since: 0.2.5.0 |
| type Rep ((:.:) k l f g p) Source # | |
| type Code ((:.:) * * f0 g0 p0) Source # | |