Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Language.Haskell.DoNotation
Description
Synopsis
- class BindSyntax (x :: Type -> Type) (y :: Type -> Type) (z :: Type -> Type) | x y -> z, x z -> y, y z -> x where
- class PureSyntax (x :: Type -> Type) where
- class Applicative m => Monad (m :: Type -> Type)
- class IxApplicative m => IxMonad (m :: k -> k -> Type -> Type)
Documentation
class BindSyntax (x :: Type -> Type) (y :: Type -> Type) (z :: Type -> Type) | x y -> z, x z -> y, y z -> x where Source #
Minimal complete definition
Instances
(Monad m, x ~ m) => BindSyntax m x m Source # | |
(IxMonad m, x ~ m i j, y ~ m j k2, z ~ m i k2) => BindSyntax x y z Source # | |
class PureSyntax (x :: Type -> Type) where Source #
Minimal complete definition
Nothing
Instances
Applicative m => PureSyntax m Source # | |
(IxMonad m, j ~ i) => PureSyntax (m i j) Source # | |
class Applicative m => Monad (m :: Type -> Type) #
The Monad
class defines the basic operations over a monad,
a concept from a branch of mathematics known as category theory.
From the perspective of a Haskell programmer, however, it is best to
think of a monad as an abstract datatype of actions.
Haskell's do
expressions provide a convenient syntax for writing
monadic expressions.
Instances of Monad
should satisfy the following:
- Left identity
return
a>>=
k = k a- Right identity
m
>>=
return
= m- Associativity
m
>>=
(\x -> k x>>=
h) = (m>>=
k)>>=
h
Furthermore, the Monad
and Applicative
operations should relate as follows:
The above laws imply:
and that pure
and (<*>
) satisfy the applicative functor laws.
The instances of Monad
for lists, Maybe
and IO
defined in the Prelude satisfy these laws.
Minimal complete definition
Instances
Monad P | Since: base-2.1 |
Monad ReadP | Since: base-2.1 |
Monad IO | Since: base-2.1 |
Monad NonEmpty | Since: base-4.9.0.0 |
Monad Maybe | Since: base-2.1 |
Monad Solo | Since: base-4.15 |
Monad [] | Since: base-2.1 |
Monad (Either e) | Since: base-4.4.0.0 |
Monoid a => Monad ((,) a) | Since: base-4.9.0.0 |
(Monoid a, Monoid b) => Monad ((,,) a b) | Since: base-4.14.0.0 |
(Monoid a, Monoid b, Monoid c) => Monad ((,,,) a b c) | Since: base-4.14.0.0 |
Monad ((->) r) | Since: base-2.1 |
Monad m => Monad (Ix m i j) Source # | |
class IxApplicative m => IxMonad (m :: k -> k -> Type -> Type) #
Minimal complete definition