streamly-0.10.1: Streaming, dataflow programming and declarative concurrency
Copyright(c) 2022 Composewell Technologies
LicenseBSD-3-Clause
Maintainerstreamly@composewell.com
Stabilityexperimental
PortabilityGHC
Safe HaskellSafe-Inferred
LanguageHaskell2010

Streamly.Internal.Data.Stream.MkType

Description

 
Synopsis

Imports for Examples

>>> :m
>>> import Language.Haskell.TH
>>> import qualified Streamly.Data.Stream.Prelude as Stream
>>> import Streamly.Internal.Data.Stream.MkType

Template Haskell Macros

mkZipType Source #

Arguments

:: String

Name of the type

-> String

Function to use for (<*>)

-> Bool

True if (<*>) requires MonadAsync constraint (concurrent)

-> Q [Dec] 

Create a type with a zip-like applicative.

>>> expr <- runQ (mkZipType "ZipStream" "zipApply" False)
>>> putStrLn $ pprint expr
newtype ZipStream m a
    = ZipStream (Stream.Stream m a)
    deriving Foldable
mkZipStream :: Stream.Stream m a -> ZipStream m a
mkZipStream = ZipStream
unZipStream :: ZipStream m a -> Stream.Stream m a
unZipStream (ZipStream strm) = strm
deriving instance IsList (ZipStream Identity a)
deriving instance a ~
                  GHC.Types.Char => IsString (ZipStream Identity a)
deriving instance GHC.Classes.Eq a => Eq (ZipStream Identity a)
deriving instance GHC.Classes.Ord a => Ord (ZipStream Identity a)
instance Show a => Show (ZipStream Identity a)
    where {{-# INLINE show #-}; show (ZipStream strm) = show strm}
instance Read a => Read (ZipStream Identity a)
    where {{-# INLINE readPrec #-}; readPrec = fmap ZipStream readPrec}
instance Monad m => Functor (ZipStream m)
    where {{-# INLINE fmap #-};
           fmap f (ZipStream strm) = ZipStream (fmap f strm)}
instance Monad m => Applicative (ZipStream m)
    where {{-# INLINE pure #-};
           pure = ZipStream . Stream.repeat;
           {-# INLINE (<*>) #-};
           (<*>) (ZipStream strm1) (ZipStream strm2) = ZipStream (zipApply strm1 strm2)}

mkCrossType Source #

Arguments

:: String

Name of the type

-> String

Function to use for (>>=)

-> Bool

True if (>>=) requires MonadAsync constraint (concurrent)

-> Q [Dec] 

Create a type with specific stream combination properties.

>>> expr <- runQ (mkCrossType "Parallel" "parBind" True)
>>> putStrLn $ pprint expr
newtype Parallel m a = Parallel (Stream.Stream m a)
mkParallel :: Stream.Stream m a -> Parallel m a
mkParallel = Parallel
unParallel :: Parallel m a -> Stream.Stream m a
unParallel (Parallel strm) = strm
instance Monad m => Functor (Parallel m)
    where {{-# INLINE fmap #-};
           fmap f (Parallel strm) = Parallel (fmap f strm)}
instance Stream.MonadAsync m => Monad (Parallel m)
    where {{-# INLINE (>>=) #-};
           (>>=) (Parallel strm1) f = let f1 a = unParallel (f a)
                                       in Parallel (parBind strm1 f1)}
instance Stream.MonadAsync m => Applicative (Parallel m)
    where {{-# INLINE pure #-};
           pure = Parallel . Stream.fromPure;
           {-# INLINE (<*>) #-};
           (<*>) = ap}
instance (Monad (Parallel m), MonadIO m) => MonadIO (Parallel m)
    where {{-# INLINE liftIO #-};
           liftIO = Parallel . (Stream.fromEffect . liftIO)}
instance (Monad (Parallel m),
          MonadThrow m) => MonadThrow (Parallel m)
    where {{-# INLINE throwM #-};
           throwM = Parallel . (Stream.fromEffect . throwM)}

Re-exports

class Monad m => MonadIO (m :: Type -> Type) where Source #

Monads in which IO computations may be embedded. Any monad built by applying a sequence of monad transformers to the IO monad will be an instance of this class.

Instances should satisfy the following laws, which state that liftIO is a transformer of monads:

Methods

liftIO :: IO a -> m a Source #

Lift a computation from the IO monad. This allows us to run IO computations in any monadic stack, so long as it supports these kinds of operations (i.e. IO is the base monad for the stack).

Example

Expand
import Control.Monad.Trans.State -- from the "transformers" library

printState :: Show s => StateT s IO ()
printState = do
  state <- get
  liftIO $ print state

Had we omitted liftIO, we would have ended up with this error:

• Couldn't match type ‘IO’ with ‘StateT s IO’
 Expected type: StateT s IO ()
   Actual type: IO ()

The important part here is the mismatch between StateT s IO () and IO ().

Luckily, we know of a function that takes an IO a and returns an (m a): liftIO, enabling us to run the program and see the expected results:

> evalStateT printState "hello"
"hello"

> evalStateT printState 3
3

Instances

Instances details
MonadIO IO

Since: base-4.9.0.0

Instance details

Defined in Control.Monad.IO.Class

Methods

liftIO :: IO a -> IO a Source #

MonadIO Q 
Instance details

Defined in Language.Haskell.TH.Syntax

Methods

liftIO :: IO a -> Q a Source #

(MonadIO m, MonadAsync m) => MonadIO (AheadT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Ahead

Methods

liftIO :: IO a -> AheadT m a Source #

(MonadIO m, MonadAsync m) => MonadIO (AsyncT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

liftIO :: IO a -> AsyncT m a Source #

(MonadIO m, MonadAsync m) => MonadIO (WAsyncT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

liftIO :: IO a -> WAsyncT m a Source #

(MonadIO m, MonadAsync m) => MonadIO (ParallelT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Parallel

Methods

liftIO :: IO a -> ParallelT m a Source #

MonadIO m => MonadIO (SerialT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

liftIO :: IO a -> SerialT m a Source #

MonadIO m => MonadIO (WSerialT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

liftIO :: IO a -> WSerialT m a Source #

MonadIO m => MonadIO (CrossStream m) 
Instance details

Defined in Streamly.Internal.Data.Stream.Type

Methods

liftIO :: IO a -> CrossStream m a Source #

MonadIO m => MonadIO (CrossStreamK m) 
Instance details

Defined in Streamly.Internal.Data.StreamK.Type

Methods

liftIO :: IO a -> CrossStreamK m a Source #

MonadIO m => MonadIO (ListT m) 
Instance details

Defined in Control.Monad.Trans.List

Methods

liftIO :: IO a -> ListT m a Source #

MonadIO m => MonadIO (MaybeT m) 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

liftIO :: IO a -> MaybeT m a Source #

MonadIO m => MonadIO (Parser a m) 
Instance details

Defined in Streamly.Internal.Data.Parser.Type

Methods

liftIO :: IO a0 -> Parser a m a0 Source #

(Monoid w, Functor m, MonadIO m) => MonadIO (AccumT w m) 
Instance details

Defined in Control.Monad.Trans.Accum

Methods

liftIO :: IO a -> AccumT w m a Source #

(Error e, MonadIO m) => MonadIO (ErrorT e m) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

liftIO :: IO a -> ErrorT e m a Source #

MonadIO m => MonadIO (ExceptT e m) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

liftIO :: IO a -> ExceptT e m a Source #

MonadIO m => MonadIO (IdentityT m) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

liftIO :: IO a -> IdentityT m a Source #

MonadIO m => MonadIO (ReaderT r m) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

liftIO :: IO a -> ReaderT r m a Source #

MonadIO m => MonadIO (SelectT r m) 
Instance details

Defined in Control.Monad.Trans.Select

Methods

liftIO :: IO a -> SelectT r m a Source #

MonadIO m => MonadIO (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

liftIO :: IO a -> StateT s m a Source #

MonadIO m => MonadIO (StateT s m) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

liftIO :: IO a -> StateT s m a Source #

MonadIO m => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.CPS

Methods

liftIO :: IO a -> WriterT w m a Source #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

liftIO :: IO a -> WriterT w m a Source #

(Monoid w, MonadIO m) => MonadIO (WriterT w m) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

liftIO :: IO a -> WriterT w m a Source #

MonadIO m => MonadIO (ContT r m) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

liftIO :: IO a -> ContT r m a Source #

MonadIO m => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.CPS

Methods

liftIO :: IO a -> RWST r w s m a Source #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

liftIO :: IO a -> RWST r w s m a Source #

(Monoid w, MonadIO m) => MonadIO (RWST r w s m) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

liftIO :: IO a -> RWST r w s m a Source #

class Monad m => MonadThrow (m :: Type -> Type) where Source #

A class for monads in which exceptions may be thrown.

Instances should obey the following law:

throwM e >> x = throwM e

In other words, throwing an exception short-circuits the rest of the monadic computation.

Methods

throwM :: Exception e => e -> m a Source #

Throw an exception. Note that this throws when this action is run in the monad m, not when it is applied. It is a generalization of Control.Exception's throwIO.

Should satisfy the law:

throwM e >> f = throwM e

Instances

Instances details
MonadThrow STM 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> STM a Source #

MonadThrow IO 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IO a Source #

MonadThrow Q 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Q a Source #

MonadThrow Maybe 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> Maybe a Source #

MonadThrow [] 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> [a] Source #

e ~ SomeException => MonadThrow (Either e) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> Either e a Source #

MonadThrow (ST s) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ST s a Source #

(MonadThrow m, MonadAsync m) => MonadThrow (AheadT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Ahead

Methods

throwM :: Exception e => e -> AheadT m a Source #

(MonadThrow m, MonadAsync m) => MonadThrow (AsyncT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

throwM :: Exception e => e -> AsyncT m a Source #

(MonadThrow m, MonadAsync m) => MonadThrow (WAsyncT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

throwM :: Exception e => e -> WAsyncT m a Source #

(MonadThrow m, MonadAsync m) => MonadThrow (ParallelT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Parallel

Methods

throwM :: Exception e => e -> ParallelT m a Source #

MonadThrow m => MonadThrow (SerialT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

throwM :: Exception e => e -> SerialT m a Source #

MonadThrow m => MonadThrow (WSerialT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

throwM :: Exception e => e -> WSerialT m a Source #

MonadThrow m => MonadThrow (CrossStream m) 
Instance details

Defined in Streamly.Internal.Data.Stream.Type

Methods

throwM :: Exception e => e -> CrossStream m a Source #

MonadThrow m => MonadThrow (CrossStreamK m) 
Instance details

Defined in Streamly.Internal.Data.StreamK.Type

Methods

throwM :: Exception e => e -> CrossStreamK m a Source #

MonadThrow m => MonadThrow (ListT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ListT m a Source #

MonadThrow m => MonadThrow (MaybeT m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> MaybeT m a Source #

(Error e, MonadThrow m) => MonadThrow (ErrorT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ErrorT e m a Source #

MonadThrow m => MonadThrow (ExceptT e m)

Throws exceptions into the base monad.

Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e0 => e0 -> ExceptT e m a Source #

MonadThrow m => MonadThrow (IdentityT m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> IdentityT m a Source #

MonadThrow m => MonadThrow (ReaderT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ReaderT r m a Source #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a Source #

MonadThrow m => MonadThrow (StateT s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> StateT s m a Source #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a Source #

(MonadThrow m, Monoid w) => MonadThrow (WriterT w m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> WriterT w m a Source #

MonadThrow m => MonadThrow (ContT r m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> ContT r m a Source #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a Source #

(MonadThrow m, Monoid w) => MonadThrow (RWST r w s m) 
Instance details

Defined in Control.Monad.Catch

Methods

throwM :: Exception e => e -> RWST r w s m a Source #

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

See examples in Control.Monad.Reader. Note, the partially applied function type (->) r is a simple reader monad. See the instance declaration below.

Minimal complete definition

(ask | reader), local

Methods

ask :: m r Source #

Retrieves the monad environment.

local Source #

Arguments

:: (r -> r)

The function to modify the environment.

-> m a

Reader to run in the modified environment.

-> m a 

Executes a computation in a modified environment.

reader Source #

Arguments

:: (r -> a)

The selector function to apply to the environment.

-> m a 

Retrieves a function of the current environment.

Instances

Instances details
(MonadReader r m, MonadAsync m) => MonadReader r (AheadT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Ahead

Methods

ask :: AheadT m r Source #

local :: (r -> r) -> AheadT m a -> AheadT m a Source #

reader :: (r -> a) -> AheadT m a Source #

(MonadReader r m, MonadAsync m) => MonadReader r (AsyncT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

ask :: AsyncT m r Source #

local :: (r -> r) -> AsyncT m a -> AsyncT m a Source #

reader :: (r -> a) -> AsyncT m a Source #

(MonadReader r m, MonadAsync m) => MonadReader r (WAsyncT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

ask :: WAsyncT m r Source #

local :: (r -> r) -> WAsyncT m a -> WAsyncT m a Source #

reader :: (r -> a) -> WAsyncT m a Source #

(MonadReader r m, MonadAsync m) => MonadReader r (ParallelT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Parallel

Methods

ask :: ParallelT m r Source #

local :: (r -> r) -> ParallelT m a -> ParallelT m a Source #

reader :: (r -> a) -> ParallelT m a Source #

MonadReader r m => MonadReader r (SerialT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

ask :: SerialT m r Source #

local :: (r -> r) -> SerialT m a -> SerialT m a Source #

reader :: (r -> a) -> SerialT m a Source #

MonadReader r m => MonadReader r (WSerialT m) Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

ask :: WSerialT m r Source #

local :: (r -> r) -> WSerialT m a -> WSerialT m a Source #

reader :: (r -> a) -> WSerialT m a Source #

MonadReader r m => MonadReader r (ListT m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ListT m r Source #

local :: (r -> r) -> ListT m a -> ListT m a Source #

reader :: (r -> a) -> ListT m a Source #

MonadReader r m => MonadReader r (MaybeT m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: MaybeT m r Source #

local :: (r -> r) -> MaybeT m a -> MaybeT m a Source #

reader :: (r -> a) -> MaybeT m a Source #

(Error e, MonadReader r m) => MonadReader r (ErrorT e m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ErrorT e m r Source #

local :: (r -> r) -> ErrorT e m a -> ErrorT e m a Source #

reader :: (r -> a) -> ErrorT e m a Source #

MonadReader r m => MonadReader r (ExceptT e m)

Since: mtl-2.2

Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ExceptT e m r Source #

local :: (r -> r) -> ExceptT e m a -> ExceptT e m a Source #

reader :: (r -> a) -> ExceptT e m a Source #

MonadReader r m => MonadReader r (IdentityT m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: IdentityT m r Source #

local :: (r -> r) -> IdentityT m a -> IdentityT m a Source #

reader :: (r -> a) -> IdentityT m a Source #

Monad m => MonadReader r (ReaderT r m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ReaderT r m r Source #

local :: (r -> r) -> ReaderT r m a -> ReaderT r m a Source #

reader :: (r -> a) -> ReaderT r m a Source #

MonadReader r m => MonadReader r (StateT s m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: StateT s m r Source #

local :: (r -> r) -> StateT s m a -> StateT s m a Source #

reader :: (r -> a) -> StateT s m a Source #

MonadReader r m => MonadReader r (StateT s m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: StateT s m r Source #

local :: (r -> r) -> StateT s m a -> StateT s m a Source #

reader :: (r -> a) -> StateT s m a Source #

(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: WriterT w m r Source #

local :: (r -> r) -> WriterT w m a -> WriterT w m a Source #

reader :: (r -> a) -> WriterT w m a Source #

(Monoid w, MonadReader r m) => MonadReader r (WriterT w m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: WriterT w m r Source #

local :: (r -> r) -> WriterT w m a -> WriterT w m a Source #

reader :: (r -> a) -> WriterT w m a Source #

MonadReader r ((->) r) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: r -> r Source #

local :: (r -> r) -> (r -> a) -> r -> a Source #

reader :: (r -> a) -> r -> a Source #

MonadReader r' m => MonadReader r' (ContT r m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: ContT r m r' Source #

local :: (r' -> r') -> ContT r m a -> ContT r m a Source #

reader :: (r' -> a) -> ContT r m a Source #

(Monad m, Monoid w) => MonadReader r (RWST r w s m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: RWST r w s m r Source #

local :: (r -> r) -> RWST r w s m a -> RWST r w s m a Source #

reader :: (r -> a) -> RWST r w s m a Source #

(Monad m, Monoid w) => MonadReader r (RWST r w s m) 
Instance details

Defined in Control.Monad.Reader.Class

Methods

ask :: RWST r w s m r Source #

local :: (r -> r) -> RWST r w s m a -> RWST r w s m a Source #

reader :: (r -> a) -> RWST r w s m a Source #

class MonadTrans (t :: (Type -> Type) -> Type -> Type) where Source #

The class of monad transformers. Instances should satisfy the following laws, which state that lift is a monad transformation:

Methods

lift :: Monad m => m a -> t m a Source #

Lift a computation from the argument monad to the constructed monad.

Instances

Instances details
MonadTrans AheadT Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Ahead

Methods

lift :: Monad m => m a -> AheadT m a Source #

MonadTrans AsyncT Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

lift :: Monad m => m a -> AsyncT m a Source #

MonadTrans WAsyncT Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Async

Methods

lift :: Monad m => m a -> WAsyncT m a Source #

MonadTrans ParallelT Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Parallel

Methods

lift :: Monad m => m a -> ParallelT m a Source #

MonadTrans SerialT Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

lift :: Monad m => m a -> SerialT m a Source #

MonadTrans WSerialT Source # 
Instance details

Defined in Streamly.Internal.Data.Stream.Serial

Methods

lift :: Monad m => m a -> WSerialT m a Source #

MonadTrans CrossStream 
Instance details

Defined in Streamly.Internal.Data.Stream.Type

Methods

lift :: Monad m => m a -> CrossStream m a Source #

MonadTrans CrossStreamK 
Instance details

Defined in Streamly.Internal.Data.StreamK.Type

Methods

lift :: Monad m => m a -> CrossStreamK m a Source #

MonadTrans ListT 
Instance details

Defined in Control.Monad.Trans.List

Methods

lift :: Monad m => m a -> ListT m a Source #

MonadTrans MaybeT 
Instance details

Defined in Control.Monad.Trans.Maybe

Methods

lift :: Monad m => m a -> MaybeT m a Source #

Monoid w => MonadTrans (AccumT w) 
Instance details

Defined in Control.Monad.Trans.Accum

Methods

lift :: Monad m => m a -> AccumT w m a Source #

MonadTrans (ErrorT e) 
Instance details

Defined in Control.Monad.Trans.Error

Methods

lift :: Monad m => m a -> ErrorT e m a Source #

MonadTrans (ExceptT e) 
Instance details

Defined in Control.Monad.Trans.Except

Methods

lift :: Monad m => m a -> ExceptT e m a Source #

MonadTrans (IdentityT :: (Type -> Type) -> Type -> Type) 
Instance details

Defined in Control.Monad.Trans.Identity

Methods

lift :: Monad m => m a -> IdentityT m a Source #

MonadTrans (ReaderT r) 
Instance details

Defined in Control.Monad.Trans.Reader

Methods

lift :: Monad m => m a -> ReaderT r m a Source #

MonadTrans (SelectT r) 
Instance details

Defined in Control.Monad.Trans.Select

Methods

lift :: Monad m => m a -> SelectT r m a Source #

MonadTrans (StateT s) 
Instance details

Defined in Control.Monad.Trans.State.Lazy

Methods

lift :: Monad m => m a -> StateT s m a Source #

MonadTrans (StateT s) 
Instance details

Defined in Control.Monad.Trans.State.Strict

Methods

lift :: Monad m => m a -> StateT s m a Source #

MonadTrans (WriterT w) 
Instance details

Defined in Control.Monad.Trans.Writer.CPS

Methods

lift :: Monad m => m a -> WriterT w m a Source #

Monoid w => MonadTrans (WriterT w) 
Instance details

Defined in Control.Monad.Trans.Writer.Lazy

Methods

lift :: Monad m => m a -> WriterT w m a Source #

Monoid w => MonadTrans (WriterT w) 
Instance details

Defined in Control.Monad.Trans.Writer.Strict

Methods

lift :: Monad m => m a -> WriterT w m a Source #

MonadTrans (ContT r) 
Instance details

Defined in Control.Monad.Trans.Cont

Methods

lift :: Monad m => m a -> ContT r m a Source #

MonadTrans (RWST r w s) 
Instance details

Defined in Control.Monad.Trans.RWS.CPS

Methods

lift :: Monad m => m a -> RWST r w s m a Source #

Monoid w => MonadTrans (RWST r w s) 
Instance details

Defined in Control.Monad.Trans.RWS.Lazy

Methods

lift :: Monad m => m a -> RWST r w s m a Source #

Monoid w => MonadTrans (RWST r w s) 
Instance details

Defined in Control.Monad.Trans.RWS.Strict

Methods

lift :: Monad m => m a -> RWST r w s m a Source #

ap :: Monad m => m (a -> b) -> m a -> m b Source #

In many situations, the liftM operations can be replaced by uses of ap, which promotes function application.

return f `ap` x1 `ap` ... `ap` xn

is equivalent to

liftMn f x1 x2 ... xn