do-notation-0.1.0.2: Generalize do-notation to work on monads and indexed monads simultaneously.
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Trans.Ix

Synopsis
  • newtype Ix (m :: Type -> Type) (i :: k) (j :: k1) a = Ix {}
  • liftIx :: forall {k} m a (i :: k). m a -> Ix m i i a
  • unsafeLiftIx :: forall {k1} {k2} m a (i :: k1) (j :: k2). m a -> Ix m i j a

Documentation

newtype Ix (m :: Type -> Type) (i :: k) (j :: k1) a Source #

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.

Constructors

Ix 

Fields

Instances

Instances details
Functor m => IxFunctor (Ix m :: k -> k1 -> Type -> Type) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

imap :: forall a b (j :: k) (k2 :: k1). (a -> b) -> Ix m j k2 a -> Ix m j k2 b #

Monad m => IxMonad (Ix m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

ibind :: forall a (j :: k) (k1 :: k) b (i :: k). (a -> Ix m j k1 b) -> Ix m i j a -> Ix m i k1 b #

MonadPlus m => IxMonadPlus (Ix m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

implus :: forall (i :: k) (j :: k) a. Ix m i j a -> Ix m i j a -> Ix m i j a #

MonadPlus m => IxMonadZero (Ix m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

imzero :: forall (i :: k) (j :: k) a. Ix m i j a #

Applicative m => IxApplicative (Ix m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

iap :: forall (i :: k) (j :: k) a b (k1 :: k). Ix m i j (a -> b) -> Ix m j k1 a -> Ix m i k1 b #

Applicative m => IxPointed (Ix m :: k -> k -> Type -> Type) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

ireturn :: forall a (i :: k). a -> Ix m i i a #

Applicative m => Applicative (Ix m i j) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

pure :: a -> Ix m i j a #

(<*>) :: Ix m i j (a -> b) -> Ix m i j a -> Ix m i j b #

liftA2 :: (a -> b -> c) -> Ix m i j a -> Ix m i j b -> Ix m i j c #

(*>) :: Ix m i j a -> Ix m i j b -> Ix m i j b #

(<*) :: Ix m i j a -> Ix m i j b -> Ix m i j a #

Functor m => Functor (Ix m i j) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

fmap :: (a -> b) -> Ix m i j a -> Ix m i j b #

(<$) :: a -> Ix m i j b -> Ix m i j a #

Monad m => Monad (Ix m i j) Source # 
Instance details

Defined in Control.Monad.Trans.Ix

Methods

(>>=) :: Ix m i j a -> (a -> Ix m i j b) -> Ix m i j b #

(>>) :: Ix m i j a -> Ix m i j b -> Ix m i j b #

return :: a -> Ix m i j a #

liftIx :: forall {k} m a (i :: k). m a -> Ix m i i a Source #

Lift an m action into 'Ix m', maintaining the current index.

unsafeLiftIx :: forall {k1} {k2} m a (i :: k1) (j :: k2). m a -> Ix m i j a Source #

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.