Applyable functors
class Functor f => Apply f
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)
(<.>) :: f (a -> b) -> f a -> f b
(.>) :: f a -> f b -> f b
a .> b = const id <$> a <.> b
(<.) :: f a -> f b -> f a
a <. b = const <$> a <.> b
liftF2 :: (a -> b -> c) -> f a -> f b -> f c
Lift a binary function into a comonad with zipping
Wrappers
Wrap an Applicative to be used as a member of Apply
WrapApplicative :: f a -> WrappedApplicative f a
Transform an Apply into an Applicative by adding a unit.
MaybeApply :: Either (f a) a -> MaybeApply f a
runMaybeApply :: MaybeApply f a -> Either (f a) a
(<.*>) :: (Apply f) => f (a -> b) -> MaybeApply f a -> f b
Apply a non-empty container of functions to a possibly-empty-with-unit container of values.
(<*.>) :: (Apply f) => MaybeApply f (a -> b) -> f a -> f b
Apply a possibly-empty-with-unit container of functions to a non-empty container of values.
traverse1Maybe :: (Traversable t, Apply f) => (a -> f b) -> t a -> MaybeApply f (t b)
Traverse a Traversable using Apply, getting the results back in a MaybeApply.
Bindable functors
class Apply m => Bind m
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)
(>>-) :: m a -> (a -> m b) -> m b
join :: m (m a) -> 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
(<<.>>) :: p (a -> b) (c -> d) -> p a c -> p b d
(.>>) :: p a b -> p c d -> p c d
a '.>' b ≡ 'const' 'id' '<$>' a '<.>' b
(<<.) :: p a b -> p c d -> p a b
a '<.' b ≡ 'const' '<$>' a '<.>' b
Instances
140
instance Apply (Tagged a)instance Apply Proxyinstance Apply f => Apply (Backwards f)instance (Apply f, Apply g) => Apply (Compose f g)instance Semigroup f => Apply (Constant f)A Constant f is not Applicative unless its f is a Monoid, but it is an instance of Apply
instance Apply f => Apply (Lift f)instance (Apply f, Apply g) => Apply (Functor.Product f g)instance Apply f => Apply (Reverse f)instance Semigroup m => Apply ((,) m)A '(,)' m is not Applicative unless its m is a Monoid, but it is an instance of Apply
instance Apply NonEmptyinstance Apply (Either a)instance Semigroup m => Apply (Const m)A Const m is not Applicative unless its m is a Monoid, but it is an instance of Apply
instance Apply ((->) m)instance Apply ZipListinstance Apply []instance Apply IOinstance Apply Maybeinstance Apply Identityinstance Apply w => Apply (IdentityT w)instance Monad m => Apply (WrappedMonad m)instance Arrow a => Apply (WrappedArrow a b)instance Apply Complexinstance Apply Qinstance Ord k => Apply (Map k)A 'Map k' is not Applicative, but it is an instance of Apply
instance Apply IntMapAn IntMap is not Applicative, but it is an instance of Apply
instance Apply Seqinstance Apply Treeinstance (Hashable k, Eq k) => Apply (HashMap k)A 'HashMap k' is not Applicative, but it is an instance of Apply
instance (Functor m, Monad m) => Apply (MaybeT m)instance (Functor m, Monad m) => Apply (ExceptT e m)instance Apply m => Apply (ReaderT e m)instance (Apply m, Semigroup w) => Apply (Strict.WriterT w m)A WriterT w m is not Applicative unless its w is a Monoid, but it is an instance of Apply
instance (Apply m, Semigroup w) => Apply (Lazy.WriterT w m)A WriterT w m is not Applicative unless its w is a Monoid, but it is an instance of Apply
instance Apply (ST s)instance Apply (Lazy.ST s)instance (Bind m) => Apply (CPS.WriterT w m)instance Bind m => Apply (Strict.StateT s m)instance Bind m => Apply (Lazy.StateT s m)instance (Bind m, Semigroup w) => Apply (Strict.RWST r w s m)An RWST r w s m is not Applicative unless its w is a Monoid, but it is an instance of Apply
instance (Bind m, Semigroup w) => Apply (Lazy.RWST r w s m)An RWST r w s m is not Applicative unless its w is a Monoid, but it is an instance of Apply
instance (Bind m) => Apply (CPS.RWST r w s m)instance Apply (ContT r m)instance (Semigroup e, Apply w) => Apply (EnvT e w)An EnvT e w is not Applicative unless its e is a Monoid, but it is an instance of Apply
instance (Apply w, Semigroup s) => Apply (StoreT s w)A StoreT s w is not Applicative unless its s is a Monoid, but it is an instance of Apply
instance Apply w => Apply (TracedT m w)instance Functor f => Functor (WrappedApplicative f)instance Applicative f => Apply (WrappedApplicative f)instance Applicative f => Applicative (WrappedApplicative f)instance Alternative f => Alternative (WrappedApplicative f)instance Functor f => Functor (MaybeApply f)instance Apply f => Apply (MaybeApply f)instance Apply f => Applicative (MaybeApply f)instance Extend f => Extend (MaybeApply f)instance Comonad f => Comonad (MaybeApply f)instance Apply (Cokleisli w a)instance Apply Downinstance Apply Monoid.Suminstance Apply Monoid.Productinstance Apply Monoid.Dualinstance Apply Monoid.Firstinstance Apply Monoid.Lastinstance Apply f => Apply (Monoid.Alt f)instance Apply Semigroup.Firstinstance Apply Semigroup.Lastinstance Apply Semigroup.Mininstance Apply Semigroup.Maxinstance (Apply f, Apply g) => Apply (f :*: g)instance Apply f => Apply (M1 i t f)instance Apply f => Apply (Rec1 f)instance (Apply f, Apply g) => Apply (f :.: g)instance Apply U1instance Semigroup c => Apply (K1 i c)A K1 i c is not Applicative unless its c is a Monoid, but it is an instance of Apply
instance Apply Par1instance Apply Generics.V1A V1 is not Applicative, but it is an instance of Apply
instance Semigroup m => Bind ((,) m)A '(,)' m is not a Monad unless its m is a Monoid, but it is an instance of Bind
instance Bind (Tagged a)instance Bind Proxyinstance Bind (Either a)instance (Bind f, Bind g) => Bind (Functor.Product f g)instance Bind ((->) m)instance Bind []instance Bind NonEmptyinstance Bind IOinstance Bind (ST s)instance Bind (Lazy.ST s)instance Bind Maybeinstance Bind Identityinstance Bind Qinstance Bind m => Bind (IdentityT m)instance Monad m => Bind (WrappedMonad m)instance (Functor m, Monad m) => Bind (MaybeT m)instance (Functor m, Monad m) => Bind (ExceptT e m)instance Bind m => Bind (ReaderT e m)instance (Bind m, Semigroup w) => Bind (Lazy.WriterT w m)A WriterT w m is not a Monad unless its w is a Monoid, but it is an instance of Bind
instance (Bind m, Semigroup w) => Bind (Strict.WriterT w m)A WriterT w m is not a Monad unless its w is a Monoid, but it is an instance of Bind
instance (Bind m) => Bind (CPS.WriterT w m)instance Bind m => Bind (Lazy.StateT s m)instance Bind m => Bind (Strict.StateT s m)instance (Bind m, Semigroup w) => Bind (Lazy.RWST r w s m)An RWST r w s m is not a Monad unless its w is a Monoid, but it is an instance of Bind
instance (Bind m, Semigroup w) => Bind (Strict.RWST r w s m)An RWST r w s m is not a Monad unless its w is a Monoid, but it is an instance of Bind
instance (Bind m) => Bind (CPS.RWST r w s m)instance Bind (ContT r m)instance Bind Complexinstance Ord k => Bind (Map k)A 'Map k' is not a Monad, but it is an instance of Bind
instance Bind IntMapAn IntMap is not a Monad, but it is an instance of Bind
instance Bind Seqinstance Bind Treeinstance (Hashable k, Eq k) => Bind (HashMap k)A 'HashMap k' is not a Monad, but it is an instance of Bind
instance Bind Downinstance Bind Monoid.Suminstance Bind Monoid.Productinstance Bind Monoid.Dualinstance Bind Monoid.Firstinstance Bind Monoid.Lastinstance Bind f => Bind (Monoid.Alt f)instance Bind Semigroup.Firstinstance Bind Semigroup.Lastinstance Bind Semigroup.Mininstance Bind Semigroup.Maxinstance Bind Generics.V1A V1 is not a Monad, but it is an instance of Bind
instance Bind Generics.U1instance Bind f => Bind (Generics.M1 i c f)instance Bind m => Bind (Generics.Rec1 m)instance Bind Generics.Par1instance (Bind f, Bind g) => Bind (f :*: g)instance Biapply (,)instance Biapply Arginstance Semigroup x => Biapply ((,,) x)instance (Semigroup x, Semigroup y) => Biapply ((,,,) x y)instance (Semigroup x, Semigroup y, Semigroup z) => Biapply ((,,,,) x y z)instance Biapply Constinstance Biapply Taggedinstance (Biapply p, Apply f, Apply g) => Biapply (Biff p f g)instance Apply f => Biapply (Clown f)instance Biapply p => Biapply (Flip p)instance Apply g => Biapply (Joker g)instance Biapply p => Apply (Join p)instance (Biapply p, Biapply q) => Biapply (Bifunctor.Product p q)instance (Apply f, Biapply p) => Biapply (Tannen f p)instance Biapply p => Biapply (WrappedBifunctor p)
- Maintainer
- Edward Kmett <ekmett@gmail.com>
- Portability
- portable
- Copyright
- (C) 2011-2018 Edward Kmett
- License
- BSD-style (see the file LICENSE)