Data.Functor.Bind.Class

semigroupoids-5.1: 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.Bind.Class

Contents

- Applyable functors
- Wrappers
- Bindable functors
- Biappliable bifunctors

Description

This module is used to resolve the cyclic we get from defining these classes here rather than in a package upstream. Otherwise we'd get orphaned heads for many instances on the types in `transformers` and `bifunctors`.

Synopsis

- class Functor f => Apply f where
- newtype WrappedApplicative f a = WrapApplicative {
  - unwrapApplicative :: f a
  }
- newtype MaybeApply f a = MaybeApply {
  - runMaybeApply :: Either (f a) a
  }
- class Apply m => Bind m where
- apDefault :: Bind f => f (a -> b) -> f a -> f b
- returning :: Functor f => f a -> (a -> b) -> f b
- class Bifunctor p => Biapply p where

# Applyable functors

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 #
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 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 #

# 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 #

# Bindable functors

class Apply m => Bind m where #

A `Monad` sans `return`.

Minimal definition: Either `join` or `>>-`

If defining both, then the following laws (the default definitions) must hold:

    join = (>>- id)
    m >>- f = join (fmap f m)

Laws:

    induced definition of <.>: f <.> x = f >>- (<$> x)

Finally, there are two associativity conditions:

    associativity of (>>-):    (m >>- f) >>- g == m >>- (\x -> f x >>- g)
    associativity of join:     join . join = join . fmap join

These can both be seen as special cases of the constraint that

    associativity of (->-): (f ->- g) ->- h = f ->- (g ->- h)

Minimal complete definition

(>>-) | join

Methods

(>>-) :: m a -> (a -> m b) -> m b infixl 1 #

join :: m (m a) -> m a #

Instances

Bind [] # |
Methods (>>-) :: [a] -> (a -> [b]) -> [b] # join :: [[a]] -> [a] #
Bind Maybe # |
Methods (>>-) :: Maybe a -> (a -> Maybe b) -> Maybe b # join :: Maybe (Maybe a) -> Maybe a #
Bind IO # |
Methods (>>-) :: IO a -> (a -> IO b) -> IO b # join :: IO (IO a) -> IO a #
Bind Identity # |
Methods (>>-) :: Identity a -> (a -> Identity b) -> Identity b # join :: Identity (Identity a) -> Identity a #
Bind Option # |
Methods (>>-) :: Option a -> (a -> Option b) -> Option b # join :: Option (Option a) -> Option a #
Bind NonEmpty # |
Methods (>>-) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b # join :: NonEmpty (NonEmpty a) -> NonEmpty a #
Bind Tree # |
Methods (>>-) :: Tree a -> (a -> Tree b) -> Tree b # join :: Tree (Tree a) -> Tree a #
Bind Seq # |
Methods (>>-) :: Seq a -> (a -> Seq b) -> Seq b # join :: Seq (Seq a) -> Seq a #
Bind IntMap # | An `IntMap` is not a `Monad`, but it is an instance of `Bind`
Methods (>>-) :: IntMap a -> (a -> IntMap b) -> IntMap b # join :: IntMap (IntMap a) -> IntMap a #
Bind ((->) m) # |
Methods (>>-) :: (m -> a) -> (a -> m -> b) -> m -> b # join :: (m -> m -> a) -> m -> a #
Bind (Either a) # |
Methods (>>-) :: Either a a -> (a -> Either a b) -> Either a b # join :: Either a (Either a a) -> Either a a #
Semigroup m => Bind ((,) m) # |
Methods (>>-) :: (m, a) -> (a -> (m, b)) -> (m, b) # join :: (m, (m, a)) -> (m, a) #
Monad m => Bind (WrappedMonad m) # |
Methods (>>-) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b # join :: WrappedMonad m (WrappedMonad m a) -> WrappedMonad m a #
Ord k => Bind (Map k) # | A `Map` is not a `Monad`, but it is an instance of `Bind`
Methods (>>-) :: Map k a -> (a -> Map k b) -> Map k b # join :: Map k (Map k a) -> Map k a #
(Functor m, Monad m) => Bind (MaybeT m) # |
Methods (>>-) :: MaybeT m a -> (a -> MaybeT m b) -> MaybeT m b # join :: MaybeT m (MaybeT m a) -> MaybeT m a #
(Apply m, Monad m) => Bind (ListT m) # |
Methods (>>-) :: ListT m a -> (a -> ListT m b) -> ListT m b # join :: ListT m (ListT m a) -> ListT m a #
Bind m => Bind (IdentityT * m) # |
Methods (>>-) :: IdentityT * m a -> (a -> IdentityT * m b) -> IdentityT * m b # join :: IdentityT * m (IdentityT * m a) -> IdentityT * m a #
(Bind m, Semigroup w) => Bind (WriterT w m) # |
Methods (>>-) :: WriterT w m a -> (a -> WriterT w m b) -> WriterT w m b # join :: WriterT w m (WriterT w m a) -> WriterT w m a #
(Bind m, Semigroup w) => Bind (WriterT w m) # |
Methods (>>-) :: WriterT w m a -> (a -> WriterT w m b) -> WriterT w m b # join :: WriterT w m (WriterT w m a) -> WriterT w m a #
Bind m => Bind (StateT s m) # |
Methods (>>-) :: StateT s m a -> (a -> StateT s m b) -> StateT s m b # join :: StateT s m (StateT s m a) -> StateT s m a #
Bind m => Bind (StateT s m) # |
Methods (>>-) :: StateT s m a -> (a -> StateT s m b) -> StateT s m b # join :: StateT s m (StateT s m a) -> StateT s m a #
(Functor m, Monad m) => Bind (ErrorT e m) # |
Methods (>>-) :: ErrorT e m a -> (a -> ErrorT e m b) -> ErrorT e m b # join :: ErrorT e m (ErrorT e m a) -> ErrorT e m a #
(Functor m, Monad m) => Bind (ExceptT e m) # |
Methods (>>-) :: ExceptT e m a -> (a -> ExceptT e m b) -> ExceptT e m b # join :: ExceptT e m (ExceptT e m a) -> ExceptT e m a #
(Bind f, Bind g) => Bind (Product * f g) # |
Methods (>>-) :: Product * f g a -> (a -> Product * f g b) -> Product * f g b # join :: Product * f g (Product * f g a) -> Product * f g a #
Bind m => Bind (ReaderT * e m) # |
Methods (>>-) :: ReaderT * e m a -> (a -> ReaderT * e m b) -> ReaderT * e m b # join :: ReaderT * e m (ReaderT * e m a) -> ReaderT * e m a #
Bind (ContT * r m) # |
Methods (>>-) :: ContT * r m a -> (a -> ContT * r m b) -> ContT * r m b # join :: ContT * r m (ContT * r m a) -> ContT * r m a #
(Bind m, Semigroup w) => Bind (RWST r w s m) # |
Methods (>>-) :: RWST r w s m a -> (a -> RWST r w s m b) -> RWST r w s m b # join :: RWST r w s m (RWST r w s m a) -> RWST r w s m a #
(Bind m, Semigroup w) => Bind (RWST r w s m) # |
Methods (>>-) :: RWST r w s m a -> (a -> RWST r w s m b) -> RWST r w s m b # join :: RWST r w s m (RWST r w s m a) -> RWST r w s m a #

apDefault :: Bind f => f (a -> b) -> f a -> f b #

returning :: Functor f => f a -> (a -> b) -> f b #

# Biappliable bifunctors

class Bifunctor p => Biapply p where #

Minimal complete definition

(<<.>>)

Methods

(<<.>>) :: p (a -> b) (c -> d) -> p a c -> p b d infixl 4 #

(.>>) :: p a b -> p c d -> p c d infixl 4 #

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

(<<.) :: p a b -> p c d -> p a b infixl 4 #

    a <. b ≡ const <$> a <.> b

Instances

Biapply (,) # |
Methods (<<.>>) :: (a -> b, c -> d) -> (a, c) -> (b, d) # (.>>) :: (a, b) -> (c, d) -> (c, d) # (<<.) :: (a, b) -> (c, d) -> (a, b) #
Biapply Arg # |
Methods (<<.>>) :: Arg (a -> b) (c -> d) -> Arg a c -> Arg b d # (.>>) :: Arg a b -> Arg c d -> Arg c d # (<<.) :: Arg a b -> Arg c d -> Arg a b #
Semigroup x => Biapply ((,,) x) # |
Methods (<<.>>) :: (x, a -> b, c -> d) -> (x, a, c) -> (x, b, d) # (.>>) :: (x, a, b) -> (x, c, d) -> (x, c, d) # (<<.) :: (x, a, b) -> (x, c, d) -> (x, a, b) #
Biapply (Const *) # |
Methods (<<.>>) :: Const * (a -> b) (c -> d) -> Const * a c -> Const * b d # (.>>) :: Const * a b -> Const * c d -> Const * c d # (<<.) :: Const * a b -> Const * c d -> Const * a b #
Biapply (Tagged *) # |
Methods (<<.>>) :: Tagged * (a -> b) (c -> d) -> Tagged * a c -> Tagged * b d # (.>>) :: Tagged * a b -> Tagged * c d -> Tagged * c d # (<<.) :: Tagged * a b -> Tagged * c d -> Tagged * a b #
(Semigroup x, Semigroup y) => Biapply ((,,,) x y) # |
Methods (<<.>>) :: (x, y, a -> b, c -> d) -> (x, y, a, c) -> (x, y, b, d) # (.>>) :: (x, y, a, b) -> (x, y, c, d) -> (x, y, c, d) # (<<.) :: (x, y, a, b) -> (x, y, c, d) -> (x, y, a, b) #
(Semigroup x, Semigroup y, Semigroup z) => Biapply ((,,,,) x y z) # |
Methods (<<.>>) :: (x, y, z, a -> b, c -> d) -> (x, y, z, a, c) -> (x, y, z, b, d) # (.>>) :: (x, y, z, a, b) -> (x, y, z, c, d) -> (x, y, z, c, d) # (<<.) :: (x, y, z, a, b) -> (x, y, z, c, d) -> (x, y, z, a, b) #
Biapply p => Biapply (WrappedBifunctor * * p) # |
Methods (<<.>>) :: WrappedBifunctor * * p (a -> b) (c -> d) -> WrappedBifunctor * * p a c -> WrappedBifunctor * * p b d # (.>>) :: WrappedBifunctor * * p a b -> WrappedBifunctor * * p c d -> WrappedBifunctor * * p c d # (<<.) :: WrappedBifunctor * * p a b -> WrappedBifunctor * * p c d -> WrappedBifunctor * * p a b #
Apply g => Biapply (Joker * * g) # |
Methods (<<.>>) :: Joker * * g (a -> b) (c -> d) -> Joker * * g a c -> Joker * * g b d # (.>>) :: Joker * * g a b -> Joker * * g c d -> Joker * * g c d # (<<.) :: Joker * * g a b -> Joker * * g c d -> Joker * * g a b #
Biapply p => Biapply (Flip * * p) # |
Methods (<<.>>) :: Flip * * p (a -> b) (c -> d) -> Flip * * p a c -> Flip * * p b d # (.>>) :: Flip * * p a b -> Flip * * p c d -> Flip * * p c d # (<<.) :: Flip * * p a b -> Flip * * p c d -> Flip * * p a b #
Apply f => Biapply (Clown * * f) # |
Methods (<<.>>) :: Clown * * f (a -> b) (c -> d) -> Clown * * f a c -> Clown * * f b d # (.>>) :: Clown * * f a b -> Clown * * f c d -> Clown * * f c d # (<<.) :: Clown * * f a b -> Clown * * f c d -> Clown * * f a b #
(Biapply p, Biapply q) => Biapply (Product * * p q) # |
Methods (<<.>>) :: Product * * p q (a -> b) (c -> d) -> Product * * p q a c -> Product * * p q b d # (.>>) :: Product * * p q a b -> Product * * p q c d -> Product * * p q c d # (<<.) :: Product * * p q a b -> Product * * p q c d -> Product * * p q a b #
(Apply f, Biapply p) => Biapply (Tannen * * * f p) # |
Methods (<<.>>) :: Tannen * * * f p (a -> b) (c -> d) -> Tannen * * * f p a c -> Tannen * * * f p b d # (.>>) :: Tannen * * * f p a b -> Tannen * * * f p c d -> Tannen * * * f p c d # (<<.) :: Tannen * * * f p a b -> Tannen * * * f p c d -> Tannen * * * f p a b #
(Biapply p, Apply f, Apply g) => Biapply (Biff * * * * p f g) # |
Methods (<<.>>) :: Biff * * * * p f g (a -> b) (c -> d) -> Biff * * * * p f g a c -> Biff * * * * p f g b d # (.>>) :: Biff * * * * p f g a b -> Biff * * * * p f g c d -> Biff * * * * p f g c d # (<<.) :: Biff * * * * p f g a b -> Biff * * * * p f g c d -> Biff * * * * p f g a b #