Description

This module provides new implementations for '(>>=)', '(>>)', pure and return so that they will work simultaneously with both regular and indexed monads.

Intended usage:

@@ {--}

Synopsis

Documentation

class BindSyntax (x :: Type -> Type) (y :: Type -> Type) (z :: Type -> Type) | x y -> z, x z -> y, y z -> x where Source #

Typeclass that provides '(>>=)' and '(>>)'.

Minimal complete definition

(>>=)

Methods

(>>=) :: x a -> (a -> y b) -> z b Source #

(>>) :: x a -> y b -> z b Source #

Instances
 (IxMonad m, x ~ m i j, y ~ m j k2, z ~ m i k2) => BindSyntax x y z Source # Instance detailsDefined in Language.Haskell.DoNotation Methods(>>=) :: x a -> (a -> y b) -> z b Source #(>>) :: x a -> y b -> z b Source # (Monad m, x ~ m) => BindSyntax m x m Source # Instance detailsDefined in Language.Haskell.DoNotation Methods(>>=) :: m a -> (a -> x b) -> m b Source #(>>) :: m a -> x b -> m b Source #

class PureSyntax (x :: Type -> Type) where Source #

Typeclass that provides pure and return.

Methods

pure :: a -> x a Source #

return :: a -> x a Source #

Instances
 Monad m => PureSyntax m Source # Instance detailsDefined in Language.Haskell.DoNotation Methodspure :: a -> m a Source #return :: a -> m a Source # (IxMonad m, j ~ i) => PureSyntax (m i j) Source # Instance detailsDefined in Language.Haskell.DoNotation Methodspure :: a -> m i j a Source #return :: a -> m i j a Source #

class Applicative m => Monad (m :: * -> *) #

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 laws:

• return a >>= k  =  k a
• m >>= return  =  m
• m >>= (\x -> k x >>= h)  =  (m >>= k) >>= h

Furthermore, the Monad and Applicative operations should relate as follows:

• pure = return
• (<*>) = ap

The above laws imply:

• fmap f xs  =  xs >>= return . f
• (>>) = (*>)

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