Copyright | (C) 2011-2015 Edward Kmett |
---|---|
License | BSD-style (see the file LICENSE) |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | provisional |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell98 |
Data.Functor.Apply
Description
Synopsis
- class Functor (f :: Type -> Type) where
- (<$>) :: Functor f => (a -> b) -> f a -> f b
- ($>) :: Functor f => f a -> b -> f b
- class Functor f => Apply f where
- (<..>) :: Apply w => w a -> w (a -> b) -> w b
- liftF3 :: Apply 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 :: Type -> Type) where #
Minimal complete definition
Instances
Apply - a strong lax semimonoidal endofunctor
class Functor f => Apply f where Source #
A strong lax semi-monoidal endofunctor.
This is equivalent to an Applicative
without pure
.
Laws:
(.
)<$>
u<.>
v<.>
w = u<.>
(v<.>
w) x<.>
(f<$>
y) = (.
f)<$>
x<.>
y f<$>
(x<.>
y) = (f.
)<$>
x<.>
y
The laws imply that .>
and <.
really ignore their
left and right results, respectively, and really
return their right and left results, respectively.
Specifically,
(mf<$>
m).>
(nf<$>
n) = nf<$>
(m.>
n) (mf<$>
m)<.
(nf<$>
n) = mf<$>
(m<.
n)
Methods
(<.>) :: f (a -> b) -> f a -> f b infixl 4 Source #
(.>) :: f a -> f b -> f b infixl 4 Source #
(<.) :: f a -> f b -> f a infixl 4 Source #
liftF2 :: (a -> b -> c) -> f a -> f b -> f c Source #
Lift a binary function into a comonad with zipping
Instances
Apply [] Source # | |
Apply Maybe Source # | |
Apply IO Source # | |
Apply Par1 Source # | |
Apply Q Source # | |
Apply Identity Source # | |
Apply Complex Source # | |
Apply Sum Source # | |
Apply Product Source # | |
Apply NonEmpty Source # | |
Apply Last Source # | |
Apply First Source # | |
Apply Dual Source # | |
Apply Down Source # | |
Apply ZipList Source # | |
Apply Seq Source # | |
Apply Tree Source # | |
Apply First Source # | |
Apply Last Source # | |
Apply Max Source # | |
Apply Min Source # | |
Apply Option Source # | |
Apply IntMap Source # | An |
Apply (Either a) Source # | |
Apply (V1 :: Type -> Type) Source # | A |
Apply (U1 :: Type -> Type) Source # | |
Semigroup m => Apply ((,) m) Source # | A '(,) m' is not |
Apply (Proxy :: Type -> Type) Source # | |
Monad m => Apply (WrappedMonad m) Source # | |
Defined in Data.Functor.Bind.Class Methods (<.>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b Source # (.>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b Source # (<.) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a Source # liftF2 :: (a -> b -> c) -> WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m c Source # | |
(Hashable k, Eq k) => Apply (HashMap k) Source # | A 'HashMap k' is not |
Defined in Data.Functor.Bind.Class | |
Apply f => Apply (Lift f) Source # | |
(Functor m, Monad m) => Apply (MaybeT m) Source # | |
Apply m => Apply (ListT m) Source # | |
Ord k => Apply (Map k) Source # | A 'Map k' is not |
Apply f => Apply (MaybeApply f) Source # | |
Defined in Data.Functor.Bind.Class Methods (<.>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b Source # (.>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b Source # (<.) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a Source # liftF2 :: (a -> b -> c) -> MaybeApply f a -> MaybeApply f b -> MaybeApply f c Source # | |
Applicative f => Apply (WrappedApplicative f) Source # | |
Defined in Data.Functor.Bind.Class Methods (<.>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b Source # (.>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b Source # (<.) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a Source # liftF2 :: (a -> b -> c) -> WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f c Source # | |
Apply f => Apply (Rec1 f) Source # | |
Apply f => Apply (Alt f) Source # | |
Semigroup m => Apply (Const m :: Type -> Type) Source # | A 'Const m' is not |
Arrow a => Apply (WrappedArrow a b) Source # | |
Defined in Data.Functor.Bind.Class Methods (<.>) :: WrappedArrow a b (a0 -> b0) -> WrappedArrow a b a0 -> WrappedArrow a b b0 Source # (.>) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b b0 Source # (<.) :: WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b a0 Source # liftF2 :: (a0 -> b0 -> c) -> WrappedArrow a b a0 -> WrappedArrow a b b0 -> WrappedArrow a b c Source # | |
Biapply p => Apply (Join p) Source # | |
Apply w => Apply (TracedT m w) Source # | |
Defined in Data.Functor.Bind.Class | |
(Apply w, Semigroup s) => Apply (StoreT s w) Source # | A 'StoreT s w' is not |
Defined in Data.Functor.Bind.Class | |
(Semigroup e, Apply w) => Apply (EnvT e w) Source # | An 'EnvT e w' is not |
Apply w => Apply (IdentityT w) Source # | |
Defined in Data.Functor.Bind.Class | |
Apply (Tagged a) Source # | |
Apply f => Apply (Backwards f) Source # | |
Defined in Data.Functor.Bind.Class | |
Semigroup f => Apply (Constant f :: Type -> Type) Source # | A 'Constant f' is not |
Defined in Data.Functor.Bind.Class | |
(Functor m, Monad m) => Apply (ErrorT e m) Source # | |
Defined in Data.Functor.Bind.Class | |
(Functor m, Monad m) => Apply (ExceptT e m) Source # | |
Defined in Data.Functor.Bind.Class | |
Apply m => Apply (ReaderT e m) Source # | |
Defined in Data.Functor.Bind.Class | |
Bind m => Apply (StateT s m) Source # | |
Defined in Data.Functor.Bind.Class | |
(Apply m, Semigroup w) => Apply (WriterT w m) Source # | A 'WriterT w m' is not |
Defined in Data.Functor.Bind.Class | |
Bind m => Apply (StateT s m) Source # | |
Defined in Data.Functor.Bind.Class | |
(Apply m, Semigroup w) => Apply (WriterT w m) Source # | A 'WriterT w m' is not |
Defined in Data.Functor.Bind.Class | |
Apply f => Apply (Reverse f) Source # | |
Defined in Data.Functor.Bind.Class | |
Apply f => Apply (Static f a) Source # | |
Defined in Data.Semigroupoid.Static | |
Apply ((->) m :: Type -> Type) Source # | |
Semigroup c => Apply (K1 i c :: Type -> Type) Source # | A 'K1 i c' is not |
(Apply f, Apply g) => Apply (f :*: g) Source # | |
Defined in Data.Functor.Bind.Class | |
Apply (Cokleisli w a) Source # | |
Defined in Data.Functor.Bind.Class Methods (<.>) :: Cokleisli w a (a0 -> b) -> Cokleisli w a a0 -> Cokleisli w a b Source # (.>) :: Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a b Source # (<.) :: Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a a0 Source # liftF2 :: (a0 -> b -> c) -> Cokleisli w a a0 -> Cokleisli w a b -> Cokleisli w a c Source # | |
(Apply f, Apply g) => Apply (Product f g) Source # | |
Defined in Data.Functor.Bind.Class | |
Apply (ContT r m) Source # | |
Defined in Data.Functor.Bind.Class | |
Apply f => Apply (M1 i t f) Source # | |
(Apply f, Apply g) => Apply (f :.: g) Source # | |
Defined in Data.Functor.Bind.Class | |
(Apply f, Apply g) => Apply (Compose f g) Source # | |
Defined in Data.Functor.Bind.Class | |
(Bind m, Semigroup w) => Apply (RWST r w s m) Source # | An 'RWST r w s m' is not |
Defined in Data.Functor.Bind.Class Methods (<.>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b Source # (.>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b Source # (<.) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source # liftF2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c Source # | |
(Bind m, Semigroup w) => Apply (RWST r w s m) Source # | An 'RWST r w s m' is not |
Defined in Data.Functor.Bind.Class Methods (<.>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b Source # (.>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b Source # (<.) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a Source # liftF2 :: (a -> b -> c) -> RWST r w s m a -> RWST r w s m b -> RWST r w s m c Source # |
(<..>) :: Apply w => w a -> w (a -> b) -> w b infixl 4 Source #
A variant of <.>
with the arguments reversed.
liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d Source #
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 Apply
Constructors
WrapApplicative | |
Fields
|
Instances
newtype MaybeApply f a Source #
Transform an Apply into an Applicative by adding a unit.
Constructors
MaybeApply | |
Fields
|