Portability | portable |
---|---|
Stability | provisional |
Maintainer | Edward Kmett <ekmett@gmail.com> |
- class Functor f where
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- ($>) :: Functor f => f a -> b -> f b
- class Functor f => FunctorApply f where
- (<..>) :: FunctorApply w => w a -> w (a -> b) -> w b
- liftF2 :: FunctorApply w => (a -> b -> c) -> w a -> w b -> w c
- liftF3 :: FunctorApply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d
- newtype WrappedApplicative f a = WrapApplicative {
- unwrapApplicative :: f a
- newtype MaybeApply f a = MaybeApply {
- runMaybeApply :: Either (f a) a
Functors
class Functor f where
The Functor
class is used for types that can be mapped over.
Instances of Functor
should satisfy the following laws:
fmap id == id fmap (f . g) == fmap f . fmap g
The instances of Functor
for lists, Data.Maybe.Maybe
and System.IO.IO
satisfy these laws.
Functor [] | |
Functor IO | |
Functor Id | |
Functor ZipList | |
Functor Maybe | |
Functor FingerTree | |
Functor Digit | |
Functor Node | |
Functor Elem | |
Functor Id | |
Functor Tree | |
Functor Seq | |
Functor ViewL | |
Functor ViewR | |
Functor IntMap | |
Functor Option | |
Functor Identity | |
Functor ((->) r) | |
Functor (Either a) | |
Functor ((,) a) | |
Functor (StateL s) | |
Functor (StateR s) | |
Functor (Const m) | |
Monad m => Functor (WrappedMonad m) | |
Functor (State s) | |
Functor (Map k) | |
Functor m => Functor (IdentityT m) | |
Functor f => Functor (MaybeApply f) | |
Functor f => Functor (WrappedApplicative f) | |
Functor f => Functor (Act f) | |
Arrow a => Functor (WrappedArrow a b) | |
Functor (Cokleisli w a) |
FunctorApply - a strong lax semimonoidal endofunctor
class Functor f => FunctorApply f whereSource
A strong lax semi-monoidal endofunctor
(<.>) :: f (a -> b) -> f a -> f bSource
(.>) :: f a -> f b -> f bSource
(<.) :: f a -> f b -> f aSource
a . b = const <$ a . b
FunctorApply [] | |
FunctorApply IO | |
FunctorApply ZipList | |
FunctorApply Maybe | |
FunctorApply Tree | |
FunctorApply Seq | |
FunctorApply IntMap | An IntMap is not Applicative, but it is an instance of |
FunctorApply Option | |
FunctorApply Identity | |
FunctorApply ((->) m) | |
FunctorApply (Either a) | |
Semigroup m => FunctorApply ((,) m) | |
Semigroup m => FunctorApply (Const m) | |
Monad m => FunctorApply (WrappedMonad m) | |
Ord k => FunctorApply (Map k) | A Map is not |
FunctorApply w => FunctorApply (IdentityT w) | |
FunctorApply f => FunctorApply (MaybeApply f) | |
Applicative f => FunctorApply (WrappedApplicative f) | |
Arrow a => FunctorApply (WrappedArrow a b) | |
FunctorApply (Cokleisli w a) |
(<..>) :: FunctorApply w => w a -> w (a -> b) -> w bSource
A variant of <.>
with the arguments reversed.
liftF2 :: FunctorApply w => (a -> b -> c) -> w a -> w b -> w cSource
Lift a binary function into a comonad with zipping
liftF3 :: FunctorApply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w dSource
Lift a ternary function into a comonad with zipping
Wrappers
newtype WrappedApplicative f a Source
Wrap an Applicative
to be used as a member of FunctorApply
WrapApplicative | |
|
Functor f => Functor (WrappedApplicative f) | |
Applicative f => Applicative (WrappedApplicative f) | |
Applicative f => FunctorApply (WrappedApplicative f) | |
Alternative f => FunctorAlt (WrappedApplicative f) | |
Alternative f => ApplicativeAlt (WrappedApplicative f) |
newtype MaybeApply f a Source
Transform a FunctorApply into an Applicative by adding a unit.
MaybeApply | |
|
Functor f => Functor (MaybeApply f) | |
FunctorApply f => Applicative (MaybeApply f) | |
Comonad f => Comonad (MaybeApply f) | |
FunctorApply f => FunctorApply (MaybeApply f) | |
ComonadApply w => ComonadApply (MaybeApply w) |