| Safe Haskell | None |
|---|---|
| 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
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
returna>>=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 List, Maybe and IO
defined in the Prelude satisfy these laws.
Minimal complete definition
Instances
| Monad Complex | Since: base-4.9.0.0 |
| Monad First | Since: base-4.9.0.0 |
| Monad Last | Since: base-4.9.0.0 |
| Monad Max | Since: base-4.9.0.0 |
| Monad Min | Since: base-4.9.0.0 |
| Monad NonEmpty | Since: base-4.9.0.0 |
| Monad IO | Since: base-2.1 |
| Monad Maybe | Since: base-2.1 |
| Monad Solo | Since: base-4.15 |
| Monad [] | Since: base-2.1 |
| Monad m => Monad (WrappedMonad m) | Since: base-4.7.0.0 |
Defined in Control.Applicative Methods (>>=) :: WrappedMonad m a -> (a -> WrappedMonad m b) -> WrappedMonad m b # (>>) :: WrappedMonad m a -> WrappedMonad m b -> WrappedMonad m b # return :: a -> WrappedMonad m a # | |
| Monoid a => Monad ((,) a) | Since: base-4.9.0.0 |
| (Monoid a, Monoid b) => Monad ((,,) a b) | Since: base-4.14.0.0 |
| (Monad f, Monad g) => Monad (Product f g) | Since: base-4.9.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