Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
This module re-exports operators from
Data.Functor.Apply
and
Data.Functor.Bind
, but under the same
names as their
Applicative
and
Monad
counterparts. This makes it convenient
to use do-notation on a type that is a
Bind
but not a monad (or an
Apply
but not an
Applicative
with
ApplicativeDo
), either using the
QualifiedDo
extension or the more traditional
RebindableSyntax
.
foo :: Apply f => f a -> f b -> f (a, b) foo as bs = Semi.do a <- as b <- bs pure (a, b) bar :: Bind m => (a -> b -> m c) -> m a -> m b -> m c bar f as bs = Semi.do a <- as b <- bs f a b
Synopsis
- fmap :: Functor f => (a -> b) -> f a -> f b
- (<*) :: Apply f => f a -> f b -> f a
- (*>) :: Apply f => f a -> f b -> f b
- (<*>) :: Apply f => f (a -> b) -> f a -> f b
- (>>) :: Bind m => m a -> m b -> m b
- (>>=) :: Bind m => m a -> (a -> m b) -> m b
- join :: Bind m => m (m a) -> m a
- pure :: Applicative f => a -> f a
- return :: Monad m => a -> m a
- fail :: Plus m => String -> m a