-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Generalize do-notation to work on monads and indexed monads simultaneously. -- -- Please see the README on GitHub at -- https://github.com/isovector/do-notation#readme @package do-notation @version 0.1.0.2 module Control.Monad.Trans.Ix -- | The free indexed monad generated from a monad m. Users are -- not expected to use Ix directly, but to newtype over it, -- specializing the kinds of i and j as necessary. -- -- GeneralizedNewtypeDeriving can be used to get the instances of -- IxFunctor, IxPointed, IxApplicative, -- IxMonad, IxMonadZero and IxMonadPlus for free. newtype Ix (m :: Type -> Type) i j a Ix :: m a -> Ix i j a [runIx] :: Ix i j a -> m a -- | Lift an m action into 'Ix m', maintaining the current index. liftIx :: m a -> Ix m i i a -- | Lift an m action into 'Ix m', changing the current index. -- unsafeLiftIx is obviously unsafe due to the fact that it can -- arbitrarily change the index. unsafeLiftIx :: m a -> Ix m i j a instance forall (m :: * -> *) k1 (i :: k1) k2 (j :: k2). GHC.Base.Monad m => GHC.Base.Monad (Control.Monad.Trans.Ix.Ix m i j) instance forall (m :: * -> *) k1 (i :: k1) k2 (j :: k2). GHC.Base.Applicative m => GHC.Base.Applicative (Control.Monad.Trans.Ix.Ix m i j) instance forall (m :: * -> *) k1 (i :: k1) k2 (j :: k2). GHC.Base.Functor m => GHC.Base.Functor (Control.Monad.Trans.Ix.Ix m i j) instance GHC.Base.Functor m => Data.Functor.Indexed.IxFunctor (Control.Monad.Trans.Ix.Ix m) instance GHC.Base.Applicative m => Data.Functor.Indexed.IxPointed (Control.Monad.Trans.Ix.Ix m) instance GHC.Base.Applicative m => Data.Functor.Indexed.IxApplicative (Control.Monad.Trans.Ix.Ix m) instance GHC.Base.Monad m => Control.Monad.Indexed.IxMonad (Control.Monad.Trans.Ix.Ix m) instance GHC.Base.MonadPlus m => Control.Monad.Indexed.IxMonadZero (Control.Monad.Trans.Ix.Ix m) instance GHC.Base.MonadPlus m => Control.Monad.Indexed.IxMonadPlus (Control.Monad.Trans.Ix.Ix m) -- | This module provides new implementations for '(>>=)', -- '(>>)', pure and return so that they will work -- simultaneously with both regular and indexed monads. -- -- Intended usage: -- -- @@ {--} -- -- import Language.Haskell.DoNotation import Prelude hiding (Monad (..), -- pure) @@ module Language.Haskell.DoNotation -- | Typeclass that provides '(>>=)' and '(>>)'. class BindSyntax (x :: Type -> Type) (y :: Type -> Type) (z :: Type -> Type) | x y -> z, x z -> y, y z -> x (>>=) :: BindSyntax x y z => x a -> (a -> y b) -> z b (>>) :: BindSyntax x y z => x a -> y b -> z b -- | Typeclass that provides pure and return. class PureSyntax (x :: Type -> Type) pure :: PureSyntax x => a -> x a return :: PureSyntax x => a -> x a -- | 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: -- -- -- -- 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. class Applicative m => Monad (m :: * -> *) class IxApplicative m => IxMonad (m :: k -> k -> * -> *) instance (GHC.Base.Monad m, x ~ m) => Language.Haskell.DoNotation.BindSyntax m x m instance forall k1 (m :: k1 -> k1 -> * -> *) (x :: * -> *) (i :: k1) (j :: k1) (y :: * -> *) (k2 :: k1) (z :: * -> *). (Control.Monad.Indexed.IxMonad m, x ~ m i j, y ~ m j k2, z ~ m i k2) => Language.Haskell.DoNotation.BindSyntax x y z instance GHC.Base.Applicative m => Language.Haskell.DoNotation.PureSyntax m instance forall k (m :: k -> k -> * -> *) (j :: k) (i :: k). (Control.Monad.Indexed.IxMonad m, j ~ i) => Language.Haskell.DoNotation.PureSyntax (m i j)