semigroupoids-5.2: Semigroupoids: Category sans id

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

Contents

- Functors
- Apply - a strong lax semimonoidal endofunctor
- Wrappers

Description

Synopsis

- class Functor f where
  - fmap :: (a -> b) -> f a -> f b
  - (<$) :: a -> f b -> f a
- (<$>) :: 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
- liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c
- 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 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, `Maybe` and `IO` satisfy these laws.

Minimal complete definition

fmap

Instances

Functor [] |
Methods fmap :: (a -> b) -> [a] -> [b] # (<$) :: a -> [b] -> [a] #
Functor Maybe |
Methods fmap :: (a -> b) -> Maybe a -> Maybe b # (<$) :: a -> Maybe b -> Maybe a #
Functor IO |
Methods fmap :: (a -> b) -> IO a -> IO b # (<$) :: a -> IO b -> IO a #
Functor V1 |
Methods fmap :: (a -> b) -> V1 a -> V1 b # (<$) :: a -> V1 b -> V1 a #
Functor U1 |
Methods fmap :: (a -> b) -> U1 a -> U1 b # (<$) :: a -> U1 b -> U1 a #
Functor Par1 |
Methods fmap :: (a -> b) -> Par1 a -> Par1 b # (<$) :: a -> Par1 b -> Par1 a #
Functor Id |
Methods fmap :: (a -> b) -> Id a -> Id b # (<$) :: a -> Id b -> Id a #
Functor Identity |
Methods fmap :: (a -> b) -> Identity a -> Identity b # (<$) :: a -> Identity b -> Identity a #
Functor Min |
Methods fmap :: (a -> b) -> Min a -> Min b # (<$) :: a -> Min b -> Min a #
Functor Max |
Methods fmap :: (a -> b) -> Max a -> Max b # (<$) :: a -> Max b -> Max a #
Functor First |
Methods fmap :: (a -> b) -> First a -> First b # (<$) :: a -> First b -> First a #
Functor Last |
Methods fmap :: (a -> b) -> Last a -> Last b # (<$) :: a -> Last b -> Last a #
Functor Option |
Methods fmap :: (a -> b) -> Option a -> Option b # (<$) :: a -> Option b -> Option a #
Functor NonEmpty |
Methods fmap :: (a -> b) -> NonEmpty a -> NonEmpty b # (<$) :: a -> NonEmpty b -> NonEmpty a #
Functor Complex |
Methods fmap :: (a -> b) -> Complex a -> Complex b # (<$) :: a -> Complex b -> Complex a #
Functor ZipList |
Methods fmap :: (a -> b) -> ZipList a -> ZipList b # (<$) :: a -> ZipList b -> ZipList a #
Functor Handler |
Methods fmap :: (a -> b) -> Handler a -> Handler b # (<$) :: a -> Handler b -> Handler a #
Functor Dual |
Methods fmap :: (a -> b) -> Dual a -> Dual b # (<$) :: a -> Dual b -> Dual a #
Functor Sum |
Methods fmap :: (a -> b) -> Sum a -> Sum b # (<$) :: a -> Sum b -> Sum a #
Functor Product |
Methods fmap :: (a -> b) -> Product a -> Product b # (<$) :: a -> Product b -> Product a #
Functor First |
Methods fmap :: (a -> b) -> First a -> First b # (<$) :: a -> First b -> First a #
Functor Last |
Methods fmap :: (a -> b) -> Last a -> Last b # (<$) :: a -> Last b -> Last a #
Functor Digit |
Methods fmap :: (a -> b) -> Digit a -> Digit b # (<$) :: a -> Digit b -> Digit a #
Functor Node |
Methods fmap :: (a -> b) -> Node a -> Node b # (<$) :: a -> Node b -> Node a #
Functor Elem |
Methods fmap :: (a -> b) -> Elem a -> Elem b # (<$) :: a -> Elem b -> Elem a #
Functor FingerTree |
Methods fmap :: (a -> b) -> FingerTree a -> FingerTree b # (<$) :: a -> FingerTree b -> FingerTree a #
Functor Tree |
Methods fmap :: (a -> b) -> Tree a -> Tree b # (<$) :: a -> Tree b -> Tree a #
Functor Seq |
Methods fmap :: (a -> b) -> Seq a -> Seq b # (<$) :: a -> Seq b -> Seq a #
Functor ViewL |
Methods fmap :: (a -> b) -> ViewL a -> ViewL b # (<$) :: a -> ViewL b -> ViewL a #
Functor ViewR |
Methods fmap :: (a -> b) -> ViewR a -> ViewR b # (<$) :: a -> ViewR b -> ViewR a #
Functor IntMap |
Methods fmap :: (a -> b) -> IntMap a -> IntMap b # (<$) :: a -> IntMap b -> IntMap a #
Functor ((->) r) |
Methods fmap :: (a -> b) -> (r -> a) -> r -> b # (<$) :: a -> (r -> b) -> r -> a #
Functor (Either a) |
Methods fmap :: (a -> b) -> Either a a -> Either a b # (<$) :: a -> Either a b -> Either a a #
Functor f => Functor (Rec1 f) |
Methods fmap :: (a -> b) -> Rec1 f a -> Rec1 f b # (<$) :: a -> Rec1 f b -> Rec1 f a #
Functor (URec Char) |
Methods fmap :: (a -> b) -> URec Char a -> URec Char b # (<$) :: a -> URec Char b -> URec Char a #
Functor (URec Double) |
Methods fmap :: (a -> b) -> URec Double a -> URec Double b # (<$) :: a -> URec Double b -> URec Double a #
Functor (URec Float) |
Methods fmap :: (a -> b) -> URec Float a -> URec Float b # (<$) :: a -> URec Float b -> URec Float a #
Functor (URec Int) |
Methods fmap :: (a -> b) -> URec Int a -> URec Int b # (<$) :: a -> URec Int b -> URec Int a #
Functor (URec Word) |
Methods fmap :: (a -> b) -> URec Word a -> URec Word b # (<$) :: a -> URec Word b -> URec Word a #
Functor (URec (Ptr ())) |
Methods fmap :: (a -> b) -> URec (Ptr ()) a -> URec (Ptr ()) b # (<$) :: a -> URec (Ptr ()) b -> URec (Ptr ()) a #
Functor ((,) a) |
Methods fmap :: (a -> b) -> (a, a) -> (a, b) # (<$) :: a -> (a, b) -> (a, a) #
Functor (Array i) |
Methods fmap :: (a -> b) -> Array i a -> Array i b # (<$) :: a -> Array i b -> Array i a #
Functor (StateL s) |
Methods fmap :: (a -> b) -> StateL s a -> StateL s b # (<$) :: a -> StateL s b -> StateL s a #
Functor (StateR s) |
Methods fmap :: (a -> b) -> StateR s a -> StateR s b # (<$) :: a -> StateR s b -> StateR s a #
Functor (Arg a) |
Methods fmap :: (a -> b) -> Arg a a -> Arg a b # (<$) :: a -> Arg a b -> Arg a a #
Monad m => Functor (WrappedMonad m) |
Methods fmap :: (a -> b) -> WrappedMonad m a -> WrappedMonad m b # (<$) :: a -> WrappedMonad m b -> WrappedMonad m a #
Arrow a => Functor (ArrowMonad a) |
Methods fmap :: (a -> b) -> ArrowMonad a a -> ArrowMonad a b # (<$) :: a -> ArrowMonad a b -> ArrowMonad a a #
Functor (Proxy *) |
Methods fmap :: (a -> b) -> Proxy * a -> Proxy * b # (<$) :: a -> Proxy * b -> Proxy * a #
Functor (StateL s) |
Methods fmap :: (a -> b) -> StateL s a -> StateL s b # (<$) :: a -> StateL s b -> StateL s a #
Functor (StateR s) |
Methods fmap :: (a -> b) -> StateR s a -> StateR s b # (<$) :: a -> StateR s b -> StateR s a #
Functor (State s) |
Methods fmap :: (a -> b) -> State s a -> State s b # (<$) :: a -> State s b -> State s a #
Functor (Map k) |
Methods fmap :: (a -> b) -> Map k a -> Map k b # (<$) :: a -> Map k b -> Map k a #
Functor f => Functor (Lift f) |
Methods fmap :: (a -> b) -> Lift f a -> Lift f b # (<$) :: a -> Lift f b -> Lift f a #
Functor m => Functor (MaybeT m) |
Methods fmap :: (a -> b) -> MaybeT m a -> MaybeT m b # (<$) :: a -> MaybeT m b -> MaybeT m a #
Functor m => Functor (ListT m) |
Methods fmap :: (a -> b) -> ListT m a -> ListT m b # (<$) :: a -> ListT m b -> ListT m a #
Functor f => Functor (MaybeApply f) # |
Methods fmap :: (a -> b) -> MaybeApply f a -> MaybeApply f b # (<$) :: a -> MaybeApply f b -> MaybeApply f a #
Functor f => Functor (WrappedApplicative f) # |
Methods fmap :: (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b # (<$) :: a -> WrappedApplicative f b -> WrappedApplicative f a #
Functor (K1 i c) |
Methods fmap :: (a -> b) -> K1 i c a -> K1 i c b # (<$) :: a -> K1 i c b -> K1 i c a #
(Functor f, Functor g) => Functor ((:+:) f g) |
Methods fmap :: (a -> b) -> (f :+: g) a -> (f :+: g) b # (<$) :: a -> (f :+: g) b -> (f :+: g) a #
(Functor f, Functor g) => Functor ((:*:) f g) |
Methods fmap :: (a -> b) -> (f :*: g) a -> (f :*: g) b # (<$) :: a -> (f :*: g) b -> (f :*: g) a #
(Functor f, Functor g) => Functor ((:.:) f g) |
Methods fmap :: (a -> b) -> (f :.: g) a -> (f :.: g) b # (<$) :: a -> (f :.: g) b -> (f :.: g) a #
Arrow a => Functor (WrappedArrow a b) |
Methods fmap :: (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b # (<$) :: a -> WrappedArrow a b b -> WrappedArrow a b a #
Functor (Const * m) |
Methods fmap :: (a -> b) -> Const * m a -> Const * m b # (<$) :: a -> Const * m b -> Const * m a #
Functor f => Functor (Alt * f) |
Methods fmap :: (a -> b) -> Alt * f a -> Alt * f b # (<$) :: a -> Alt * f b -> Alt * f a #
Bifunctor p => Functor (Join * p) |
Methods fmap :: (a -> b) -> Join * p a -> Join * p b # (<$) :: a -> Join * p b -> Join * p a #
Functor w => Functor (TracedT m w) |
Methods fmap :: (a -> b) -> TracedT m w a -> TracedT m w b # (<$) :: a -> TracedT m w b -> TracedT m w a #
Functor w => Functor (StoreT s w) |
Methods fmap :: (a -> b) -> StoreT s w a -> StoreT s w b # (<$) :: a -> StoreT s w b -> StoreT s w a #
Functor w => Functor (EnvT e w) |
Methods fmap :: (a -> b) -> EnvT e w a -> EnvT e w b # (<$) :: a -> EnvT e w b -> EnvT e w a #
Functor (Cokleisli w a) |
Methods fmap :: (a -> b) -> Cokleisli w a a -> Cokleisli w a b # (<$) :: a -> Cokleisli w a b -> Cokleisli w a a #
Functor m => Functor (IdentityT * m) |
Methods fmap :: (a -> b) -> IdentityT * m a -> IdentityT * m b # (<$) :: a -> IdentityT * m b -> IdentityT * m a #
Functor (Tagged k s) |
Methods fmap :: (a -> b) -> Tagged k s a -> Tagged k s b # (<$) :: a -> Tagged k s b -> Tagged k s a #
Functor f => Functor (Reverse * f) | Derived instance.
Methods fmap :: (a -> b) -> Reverse * f a -> Reverse * f b # (<$) :: a -> Reverse * f b -> Reverse * f a #
Functor f => Functor (Backwards * f) | Derived instance.
Methods fmap :: (a -> b) -> Backwards * f a -> Backwards * f b # (<$) :: a -> Backwards * f b -> Backwards * f a #
Functor m => Functor (WriterT w m) |
Methods fmap :: (a -> b) -> WriterT w m a -> WriterT w m b # (<$) :: a -> WriterT w m b -> WriterT w m a #
Functor m => Functor (WriterT w m) |
Methods fmap :: (a -> b) -> WriterT w m a -> WriterT w m b # (<$) :: a -> WriterT w m b -> WriterT w m a #
Functor m => Functor (StateT s m) |
Methods fmap :: (a -> b) -> StateT s m a -> StateT s m b # (<$) :: a -> StateT s m b -> StateT s m a #
Functor m => Functor (StateT s m) |
Methods fmap :: (a -> b) -> StateT s m a -> StateT s m b # (<$) :: a -> StateT s m b -> StateT s m a #
Functor m => Functor (ErrorT e m) |
Methods fmap :: (a -> b) -> ErrorT e m a -> ErrorT e m b # (<$) :: a -> ErrorT e m b -> ErrorT e m a #
Functor m => Functor (ExceptT e m) |
Methods fmap :: (a -> b) -> ExceptT e m a -> ExceptT e m b # (<$) :: a -> ExceptT e m b -> ExceptT e m a #
Functor (Constant * a) |
Methods fmap :: (a -> b) -> Constant * a a -> Constant * a b # (<$) :: a -> Constant * a b -> Constant * a a #
Functor f => Functor (Static f a) # |
Methods fmap :: (a -> b) -> Static f a a -> Static f a b # (<$) :: a -> Static f a b -> Static f a a #
Functor f => Functor (M1 i c f) |
Methods fmap :: (a -> b) -> M1 i c f a -> M1 i c f b # (<$) :: a -> M1 i c f b -> M1 i c f a #
(Functor f, Functor g) => Functor (Sum * f g) |
Methods fmap :: (a -> b) -> Sum * f g a -> Sum * f g b # (<$) :: a -> Sum * f g b -> Sum * f g a #
(Functor f, Functor g) => Functor (Product * f g) |
Methods fmap :: (a -> b) -> Product * f g a -> Product * f g b # (<$) :: a -> Product * f g b -> Product * f g a #
Functor m => Functor (ReaderT * r m) |
Methods fmap :: (a -> b) -> ReaderT * r m a -> ReaderT * r m b # (<$) :: a -> ReaderT * r m b -> ReaderT * r m a #
Functor (ContT k r m) |
Methods fmap :: (a -> b) -> ContT k r m a -> ContT k r m b # (<$) :: a -> ContT k r m b -> ContT k r m a #
(Functor f, Functor g) => Functor (Compose * * f g) |
Methods fmap :: (a -> b) -> Compose * * f g a -> Compose * * f g b # (<$) :: a -> Compose * * f g b -> Compose * * f g a #
Bifunctor p => Functor (WrappedBifunctor * * p a) |
Methods fmap :: (a -> b) -> WrappedBifunctor * * p a a -> WrappedBifunctor * * p a b # (<$) :: a -> WrappedBifunctor * * p a b -> WrappedBifunctor * * p a a #
Functor g => Functor (Joker k * g a) |
Methods fmap :: (a -> b) -> Joker k * g a a -> Joker k * g a b # (<$) :: a -> Joker k * g a b -> Joker k * g a a #
Bifunctor p => Functor (Flip * * p a) |
Methods fmap :: (a -> b) -> Flip * * p a a -> Flip * * p a b # (<$) :: a -> Flip * * p a b -> Flip * * p a a #
Functor (Clown * k f a) |
Methods fmap :: (a -> b) -> Clown * k f a a -> Clown * k f a b # (<$) :: a -> Clown * k f a b -> Clown * k f a a #
Functor m => Functor (RWST r w s m) |
Methods fmap :: (a -> b) -> RWST r w s m a -> RWST r w s m b # (<$) :: a -> RWST r w s m b -> RWST r w s m a #
Functor m => Functor (RWST r w s m) |
Methods fmap :: (a -> b) -> RWST r w s m a -> RWST r w s m b # (<$) :: a -> RWST r w s m b -> RWST r w s m a #
(Functor f, Bifunctor p) => Functor (Tannen * * * f p a) |
Methods fmap :: (a -> b) -> Tannen * * * f p a a -> Tannen * * * f p a b # (<$) :: a -> Tannen * * * f p a b -> Tannen * * * f p a a #
(Bifunctor p, Functor g) => Functor (Biff * k * * p f g a) |
Methods fmap :: (a -> b) -> Biff * k * * p f g a a -> Biff * k * * p f g a b # (<$) :: a -> Biff * k * * p f g a b -> Biff * k * * p f g a a #

(<$>) :: Functor f => (a -> b) -> f a -> f b infixl 4 #

An infix synonym for `fmap`.

The name of this operator is an allusion to `$`. Note the similarities between their types:

     ($)  ::              (a -> b) ->   a ->   b
    (<$>) :: Functor f => (a -> b) -> f a -> f b

Whereas `$` is function application, `<$>` is function application lifted over a `Functor`.

#### Examples

Convert from a ``Maybe` `Int`` to a ``Maybe` `String`` using `show`:

    >>> show <$> Nothing
    Nothing
    >>> show <$> Just 3
    Just "3"

Convert from an ``Either` `Int` `Int`` to an ``Either` `Int`` `String` using `show`:

    >>> show <$> Left 17
    Left 17
    >>> show <$> Right 17
    Right "17"

Double each element of a list:

    >>> (*2) <$> [1,2,3]
    [2,4,6]

Apply `even` to the second element of a pair:

    >>> even <$> (2,2)
    (2,True)

($>) :: Functor f => f a -> b -> f b infixl 4 #

Flipped version of `<$`.

#### Examples

Replace the contents of a ``Maybe` `Int`` with a constant `String`:

    >>> Nothing $> "foo"
    Nothing
    >>> Just 90210 $> "foo"
    Just "foo"

Replace the contents of an ``Either` `Int` `Int`` with a constant `String`, resulting in an ``Either` `Int` `String``:

    >>> Left 8675309 $> "foo"
    Left 8675309
    >>> Right 8675309 $> "foo"
    Right "foo"

Replace each element of a list with a constant `String`:

    >>> [1,2,3] $> "foo"
    ["foo","foo","foo"]

Replace the second element of a pair with a constant `String`:

    >>> (1,2) $> "foo"
    (1,"foo")

Since: 4.7.0.0

# Apply - a strong lax semimonoidal endofunctor

class Functor f => Apply f where #

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)

Minimal complete definition

(<.>)

Methods

(<.>) :: f (a -> b) -> f a -> f b infixl 4 #

(.>) :: f a -> f b -> f b infixl 4 #

     a .> b = const id <$> a <.> b

(<.) :: f a -> f b -> f a infixl 4 #

     a <. b = const <$> a <.> b

Instances

Apply [] # |
Methods (<.>) :: [a -> b] -> [a] -> [b] # (.>) :: [a] -> [b] -> [b] # (<.) :: [a] -> [b] -> [a] #
Apply Maybe # |
Methods (<.>) :: Maybe (a -> b) -> Maybe a -> Maybe b # (.>) :: Maybe a -> Maybe b -> Maybe b # (<.) :: Maybe a -> Maybe b -> Maybe a #
Apply IO # |
Methods (<.>) :: IO (a -> b) -> IO a -> IO b # (.>) :: IO a -> IO b -> IO b # (<.) :: IO a -> IO b -> IO a #
Apply Identity # |
Methods (<.>) :: Identity (a -> b) -> Identity a -> Identity b # (.>) :: Identity a -> Identity b -> Identity b # (<.) :: Identity a -> Identity b -> Identity a #
Apply Option # |
Methods (<.>) :: Option (a -> b) -> Option a -> Option b # (.>) :: Option a -> Option b -> Option b # (<.) :: Option a -> Option b -> Option a #
Apply NonEmpty # |
Methods (<.>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b # (.>) :: NonEmpty a -> NonEmpty b -> NonEmpty b # (<.) :: NonEmpty a -> NonEmpty b -> NonEmpty a #
Apply ZipList # |
Methods (<.>) :: ZipList (a -> b) -> ZipList a -> ZipList b # (.>) :: ZipList a -> ZipList b -> ZipList b # (<.) :: ZipList a -> ZipList b -> ZipList a #
Apply Tree # |
Methods (<.>) :: Tree (a -> b) -> Tree a -> Tree b # (.>) :: Tree a -> Tree b -> Tree b # (<.) :: Tree a -> Tree b -> Tree a #
Apply Seq # |
Methods (<.>) :: Seq (a -> b) -> Seq a -> Seq b # (.>) :: Seq a -> Seq b -> Seq b # (<.) :: Seq a -> Seq b -> Seq a #
Apply IntMap # | An IntMap is not `Applicative`, but it is an instance of `Apply`
Methods (<.>) :: IntMap (a -> b) -> IntMap a -> IntMap b # (.>) :: IntMap a -> IntMap b -> IntMap b # (<.) :: IntMap a -> IntMap b -> IntMap a #
Apply ((->) m) # |
Methods (<.>) :: (m -> a -> b) -> (m -> a) -> m -> b # (.>) :: (m -> a) -> (m -> b) -> m -> b # (<.) :: (m -> a) -> (m -> b) -> m -> a #
Apply (Either a) # |
Methods (<.>) :: Either a (a -> b) -> Either a a -> Either a b # (.>) :: Either a a -> Either a b -> Either a b # (<.) :: Either a a -> Either a b -> Either a a #
Semigroup m => Apply ((,) m) # |
Methods (<.>) :: (m, a -> b) -> (m, a) -> (m, b) # (.>) :: (m, a) -> (m, b) -> (m, b) # (<.) :: (m, a) -> (m, b) -> (m, a) #
Monad m => Apply (WrappedMonad m) # |
Methods (<.>) :: WrappedMonad m (a -> b) -> WrappedMonad m a -> WrappedMonad m b # (.>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # (<.) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m a #
Apply (Proxy *) # |
Methods (<.>) :: Proxy * (a -> b) -> Proxy * a -> Proxy * b # (.>) :: Proxy * a -> Proxy * b -> Proxy * b # (<.) :: Proxy * a -> Proxy * b -> Proxy * a #
Ord k => Apply (Map k) # | A Map is not `Applicative`, but it is an instance of `Apply`
Methods (<.>) :: Map k (a -> b) -> Map k a -> Map k b # (.>) :: Map k a -> Map k b -> Map k b # (<.) :: Map k a -> Map k b -> Map k a #
Apply f => Apply (Lift f) # |
Methods (<.>) :: Lift f (a -> b) -> Lift f a -> Lift f b # (.>) :: Lift f a -> Lift f b -> Lift f b # (<.) :: Lift f a -> Lift f b -> Lift f a #
(Functor m, Monad m) => Apply (MaybeT m) # |
Methods (<.>) :: MaybeT m (a -> b) -> MaybeT m a -> MaybeT m b # (.>) :: MaybeT m a -> MaybeT m b -> MaybeT m b # (<.) :: MaybeT m a -> MaybeT m b -> MaybeT m a #
Apply m => Apply (ListT m) # |
Methods (<.>) :: ListT m (a -> b) -> ListT m a -> ListT m b # (.>) :: ListT m a -> ListT m b -> ListT m b # (<.) :: ListT m a -> ListT m b -> ListT m a #
Apply f => Apply (MaybeApply f) # |
Methods (<.>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b # (.>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b # (<.) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a #
Applicative f => Apply (WrappedApplicative f) # |
Methods (<.>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b # (.>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b # (<.) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a #
Arrow a => Apply (WrappedArrow a b) # |
Methods (<.>) :: WrappedArrow a b (a -> b) -> WrappedArrow a b a -> WrappedArrow a b b # (.>) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b b # (<.) :: WrappedArrow a b a -> WrappedArrow a b b -> WrappedArrow a b a #
Semigroup m => Apply (Const * m) # |
Methods (<.>) :: Const * m (a -> b) -> Const * m a -> Const * m b # (.>) :: Const * m a -> Const * m b -> Const * m b # (<.) :: Const * m a -> Const * m b -> Const * m a #
Biapply p => Apply (Join * p) # |
Methods (<.>) :: Join * p (a -> b) -> Join * p a -> Join * p b # (.>) :: Join * p a -> Join * p b -> Join * p b # (<.) :: Join * p a -> Join * p b -> Join * p a #
Apply w => Apply (TracedT m w) # |
Methods (<.>) :: TracedT m w (a -> b) -> TracedT m w a -> TracedT m w b # (.>) :: TracedT m w a -> TracedT m w b -> TracedT m w b # (<.) :: TracedT m w a -> TracedT m w b -> TracedT m w a #
(Apply w, Semigroup s) => Apply (StoreT s w) # |
Methods (<.>) :: StoreT s w (a -> b) -> StoreT s w a -> StoreT s w b # (.>) :: StoreT s w a -> StoreT s w b -> StoreT s w b # (<.) :: StoreT s w a -> StoreT s w b -> StoreT s w a #
(Semigroup e, Apply w) => Apply (EnvT e w) # |
Methods (<.>) :: EnvT e w (a -> b) -> EnvT e w a -> EnvT e w b # (.>) :: EnvT e w a -> EnvT e w b -> EnvT e w b # (<.) :: EnvT e w a -> EnvT e w b -> EnvT e w a #
Apply (Cokleisli w a) # |
Methods (<.>) :: Cokleisli w a (a -> b) -> Cokleisli w a a -> Cokleisli w a b # (.>) :: Cokleisli w a a -> Cokleisli w a b -> Cokleisli w a b # (<.) :: Cokleisli w a a -> Cokleisli w a b -> Cokleisli w a a #
Apply w => Apply (IdentityT * w) # |
Methods (<.>) :: IdentityT * w (a -> b) -> IdentityT * w a -> IdentityT * w b # (.>) :: IdentityT * w a -> IdentityT * w b -> IdentityT * w b # (<.) :: IdentityT * w a -> IdentityT * w b -> IdentityT * w a #
Apply (Tagged * a) # |
Methods (<.>) :: Tagged * a (a -> b) -> Tagged * a a -> Tagged * a b # (.>) :: Tagged * a a -> Tagged * a b -> Tagged * a b # (<.) :: Tagged * a a -> Tagged * a b -> Tagged * a a #
Apply f => Apply (Reverse * f) # |
Methods (<.>) :: Reverse * f (a -> b) -> Reverse * f a -> Reverse * f b # (.>) :: Reverse * f a -> Reverse * f b -> Reverse * f b # (<.) :: Reverse * f a -> Reverse * f b -> Reverse * f a #
Apply f => Apply (Backwards * f) # |
Methods (<.>) :: Backwards * f (a -> b) -> Backwards * f a -> Backwards * f b # (.>) :: Backwards * f a -> Backwards * f b -> Backwards * f b # (<.) :: Backwards * f a -> Backwards * f b -> Backwards * f a #
(Apply m, Semigroup w) => Apply (WriterT w m) # |
Methods (<.>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b # (.>) :: WriterT w m a -> WriterT w m b -> WriterT w m b # (<.) :: WriterT w m a -> WriterT w m b -> WriterT w m a #
(Apply m, Semigroup w) => Apply (WriterT w m) # |
Methods (<.>) :: WriterT w m (a -> b) -> WriterT w m a -> WriterT w m b # (.>) :: WriterT w m a -> WriterT w m b -> WriterT w m b # (<.) :: WriterT w m a -> WriterT w m b -> WriterT w m a #
Bind m => Apply (StateT s m) # |
Methods (<.>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b # (.>) :: StateT s m a -> StateT s m b -> StateT s m b # (<.) :: StateT s m a -> StateT s m b -> StateT s m a #
Bind m => Apply (StateT s m) # |
Methods (<.>) :: StateT s m (a -> b) -> StateT s m a -> StateT s m b # (.>) :: StateT s m a -> StateT s m b -> StateT s m b # (<.) :: StateT s m a -> StateT s m b -> StateT s m a #
(Functor m, Monad m) => Apply (ErrorT e m) # |
Methods (<.>) :: ErrorT e m (a -> b) -> ErrorT e m a -> ErrorT e m b # (.>) :: ErrorT e m a -> ErrorT e m b -> ErrorT e m b # (<.) :: ErrorT e m a -> ErrorT e m b -> ErrorT e m a #
(Functor m, Monad m) => Apply (ExceptT e m) # |
Methods (<.>) :: ExceptT e m (a -> b) -> ExceptT e m a -> ExceptT e m b # (.>) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m b # (<.) :: ExceptT e m a -> ExceptT e m b -> ExceptT e m a #
Semigroup f => Apply (Constant * f) # |
Methods (<.>) :: Constant * f (a -> b) -> Constant * f a -> Constant * f b # (.>) :: Constant * f a -> Constant * f b -> Constant * f b # (<.) :: Constant * f a -> Constant * f b -> Constant * f a #
Apply f => Apply (Static f a) # |
Methods (<.>) :: Static f a (a -> b) -> Static f a a -> Static f a b # (.>) :: Static f a a -> Static f a b -> Static f a b # (<.) :: Static f a a -> Static f a b -> Static f a a #
(Apply f, Apply g) => Apply (Product * f g) # |
Methods (<.>) :: Product * f g (a -> b) -> Product * f g a -> Product * f g b # (.>) :: Product * f g a -> Product * f g b -> Product * f g b # (<.) :: Product * f g a -> Product * f g b -> Product * f g a #
Apply m => Apply (ReaderT * e m) # |
Methods (<.>) :: ReaderT * e m (a -> b) -> ReaderT * e m a -> ReaderT * e m b # (.>) :: ReaderT * e m a -> ReaderT * e m b -> ReaderT * e m b # (<.) :: ReaderT * e m a -> ReaderT * e m b -> ReaderT * e m a #
Apply (ContT * r m) # |
Methods (<.>) :: ContT * r m (a -> b) -> ContT * r m a -> ContT * r m b # (.>) :: ContT * r m a -> ContT * r m b -> ContT * r m b # (<.) :: ContT * r m a -> ContT * r m b -> ContT * r m a #
(Apply f, Apply g) => Apply (Compose * * f g) # |
Methods (<.>) :: Compose * * f g (a -> b) -> Compose * * f g a -> Compose * * f g b # (.>) :: Compose * * f g a -> Compose * * f g b -> Compose * * f g b # (<.) :: Compose * * f g a -> Compose * * f g b -> Compose * * f g a #
(Bind m, Semigroup w) => Apply (RWST r w s m) # |
Methods (<.>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b # (.>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b # (<.) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a #
(Bind m, Semigroup w) => Apply (RWST r w s m) # |
Methods (<.>) :: RWST r w s m (a -> b) -> RWST r w s m a -> RWST r w s m b # (.>) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m b # (<.) :: RWST r w s m a -> RWST r w s m b -> RWST r w s m a #

(<..>) :: Apply w => w a -> w (a -> b) -> w b infixl 4 #

A variant of `<.>` with the arguments reversed.

liftF2 :: Apply w => (a -> b -> c) -> w a -> w b -> w c #

Lift a binary function into a comonad with zipping

liftF3 :: Apply w => (a -> b -> c -> d) -> w a -> w b -> w c -> w d #

Lift a ternary function into a comonad with zipping

# Wrappers

newtype WrappedApplicative f a #

Wrap an `Applicative` to be used as a member of `Apply`

Constructors

WrapApplicative |
Fields unwrapApplicative :: f a

Instances

Functor f => Functor (WrappedApplicative f) # |
Methods fmap :: (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b # (<$) :: a -> WrappedApplicative f b -> WrappedApplicative f a #
Applicative f => Applicative (WrappedApplicative f) # |
Methods pure :: a -> WrappedApplicative f a # (<*>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b # (*>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b # (<*) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a #
Alternative f => Alternative (WrappedApplicative f) # |
Methods empty :: WrappedApplicative f a # (<|>) :: WrappedApplicative f a -> WrappedApplicative f a -> WrappedApplicative f a # some :: WrappedApplicative f a -> WrappedApplicative f [a] # many :: WrappedApplicative f a -> WrappedApplicative f [a] #
Applicative f => Apply (WrappedApplicative f) # |
Methods (<.>) :: WrappedApplicative f (a -> b) -> WrappedApplicative f a -> WrappedApplicative f b # (.>) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f b # (<.) :: WrappedApplicative f a -> WrappedApplicative f b -> WrappedApplicative f a #
Alternative f => Alt (WrappedApplicative f) # |
Methods (<!>) :: WrappedApplicative f a -> WrappedApplicative f a -> WrappedApplicative f a # some :: Applicative (WrappedApplicative f) => WrappedApplicative f a -> WrappedApplicative f [a] # many :: Applicative (WrappedApplicative f) => WrappedApplicative f a -> WrappedApplicative f [a] #
Alternative f => Plus (WrappedApplicative f) # |
Methods zero :: WrappedApplicative f a #

newtype MaybeApply f a #

Transform a Apply into an Applicative by adding a unit.

Constructors

MaybeApply |
Fields runMaybeApply :: Either (f a) a

Instances

Functor f => Functor (MaybeApply f) # |
Methods fmap :: (a -> b) -> MaybeApply f a -> MaybeApply f b # (<$) :: a -> MaybeApply f b -> MaybeApply f a #
Apply f => Applicative (MaybeApply f) # |
Methods pure :: a -> MaybeApply f a # (<*>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b # (*>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b # (<*) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a #
Comonad f => Comonad (MaybeApply f) # |
Methods extract :: MaybeApply f a -> a # duplicate :: MaybeApply f a -> MaybeApply f (MaybeApply f a) # extend :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b #
Extend f => Extend (MaybeApply f) # |
Methods duplicated :: MaybeApply f a -> MaybeApply f (MaybeApply f a) # extended :: (MaybeApply f a -> b) -> MaybeApply f a -> MaybeApply f b #
Apply f => Apply (MaybeApply f) # |
Methods (<.>) :: MaybeApply f (a -> b) -> MaybeApply f a -> MaybeApply f b # (.>) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f b # (<.) :: MaybeApply f a -> MaybeApply f b -> MaybeApply f a #