Copyright | (C) Koz Ross 2021 |
---|---|
License | Apache 2.0 |
Maintainer | koz.ross@retro-freedom.nz |
Stability | Experimental |
Portability | GHC only |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Provides definitions needed to use do-notation (by way of QualifiedDo
)
using the more general type classes provided by semigroupoids
.
To use this module, enable QualifiedDo
, import this module qualified, and
then prefix do
with the qualified name:
{-# LANGUAGE QualifiedDo #-} module MyModule where import Data.Functor.Bind (Bind) import qualified Semigroupoids.Do as S foo :: (Bind m) => m a foo = S.do ...
This module is designed to work correctly (and similarly generally) with
ApplicativeDo
and RecursiveDo
(inasfar as that is possible).
Synopsis
- (>>=) :: forall (m :: Type -> Type) (a :: Type) (b :: Type). Bind m => m a -> (a -> m b) -> m b
- (>>) :: forall (m :: Type -> Type) (a :: Type) (b :: Type). Bind m => m a -> m b -> m b
- fail :: forall (m :: Type -> Type) (a :: Type). Plus m => String -> m a
- fmap :: Functor f => (a -> b) -> f a -> f b
- (<*>) :: forall (f :: Type -> Type) (a :: Type) (b :: Type). Apply f => f (a -> b) -> f a -> f b
- join :: forall (m :: Type -> Type) (a :: Type). Bind m => m (m a) -> m a
- mfix :: MonadFix m => (a -> m a) -> m a
- return :: forall (f :: Type -> Type) (a :: Type). Applicative f => a -> f a
Documentation
(>>=) :: forall (m :: Type -> Type) (a :: Type) (b :: Type). Bind m => m a -> (a -> m b) -> m b Source #
Since: 1.0
(>>) :: forall (m :: Type -> Type) (a :: Type) (b :: Type). Bind m => m a -> m b -> m b Source #
Since: 1.0
fmap :: Functor f => (a -> b) -> f a -> f b #
Using ApplicativeDo
: '
' can be understood as
the fmap
f asdo
expression
do a <- as pure (f a)
with an inferred Functor
constraint.
(<*>) :: forall (f :: Type -> Type) (a :: Type) (b :: Type). Apply f => f (a -> b) -> f a -> f b Source #
Since: 1.0