darcs-2.18.2: a distributed, interactive, smart revision control system

Safe Haskell | None
Language | Haskell2010

Darcs.Util.IndexedMonad

Synopsis

- class Monad (m :: Type -> Type -> Type -> Type) where
  - return :: a -> m i i a
  - (>>=) :: m i j a -> (a -> m j k b) -> m i k b
  - (>>) :: m i j a -> m j k b -> m i k b
- class LiftIx (t :: (Type -> Type) -> Type -> Type -> Type -> Type) where
  - liftIx :: m a -> t m i i a
- when :: Monad m => Bool -> m i i () -> m i i ()
- ifThenElse :: Bool -> a -> a -> a
- class Monad m => MonadReader r (m :: Type -> Type -> Type -> Type) | m -> r where
  - ask :: m i i r
  - local :: (r -> r) -> m i i a -> m i i a
- newtype ReaderT r (m :: Type -> Type -> Type -> Type) i j a = ReaderT {
  - runReaderT :: r -> m i j a
  }
- asks :: MonadReader r m => (r -> a) -> m i i a

# Documentation

class Monad (m :: Type -> Type -> Type -> Type) where #

An alternative monad class, indexed by a "from" and "to" state.

Methods

return :: a -> m i i a #

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

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

#### Instances

Instances details

Monad m => Monad (ReaderT r m) # |
Instance details Defined in Darcs.Util.IndexedMonad Methods return :: a -> ReaderT r m i i a # (>>=) :: ReaderT r m i j a -> (a -> ReaderT r m j k b) -> ReaderT r m i k b # (>>) :: ReaderT r m i j a -> ReaderT r m j k b -> ReaderT r m i k b #

class LiftIx (t :: (Type -> Type) -> Type -> Type -> Type -> Type) where #

A class for indexed monad transformers, going from normal Haskell monads into our indexed monads.

Methods

liftIx :: m a -> t m i i a #

when :: Monad m => Bool -> m i i () -> m i i () #

ifThenElse :: Bool -> a -> a -> a #

class Monad m => MonadReader r (m :: Type -> Type -> Type -> Type) | m -> r where #

An indexed version of the standard `MonadReader` class

Methods

ask :: m i i r #

local :: (r -> r) -> m i i a -> m i i a #

#### Instances

Instances details

Monad m => MonadReader r (ReaderT r m) # |
Instance details Defined in Darcs.Util.IndexedMonad Methods ask :: ReaderT r m i i r # local :: (r -> r) -> ReaderT r m i i a -> ReaderT r m i i a #

newtype ReaderT r (m :: Type -> Type -> Type -> Type) i j a #

An indexed version of the standard `ReaderT` transformer

Constructors

ReaderT |

Fields

- runReaderT :: r -> m i j a

#### Instances

Instances details

Monad m => MonadReader r (ReaderT r m) # |
Instance details Defined in Darcs.Util.IndexedMonad Methods ask :: ReaderT r m i i r # local :: (r -> r) -> ReaderT r m i i a -> ReaderT r m i i a #
Monad m => Monad (ReaderT r m) # |
Instance details Defined in Darcs.Util.IndexedMonad Methods return :: a -> ReaderT r m i i a # (>>=) :: ReaderT r m i j a -> (a -> ReaderT r m j k b) -> ReaderT r m i k b # (>>) :: ReaderT r m i j a -> ReaderT r m j k b -> ReaderT r m i k b #

asks :: MonadReader r m => (r -> a) -> m i i a #