S      !"#$%&'()*+,- . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~  portable experimentallibraries@haskell.orgConstant functor. portable experimentallibraries@haskell.org'Right-to-left composition of functors. portable experimentallibraries@haskell.orgIdentity functor and monad. portable experimentallibraries@haskell.org ?The class of monad transformers. Instances should satisfy the " following laws, which state that   is a transformer of monads:    .  =    (m >>= f) =   m >>= (  . f) ELift a computation from the argument monad to the constructed monad.     portable experimentallibraries@haskell.org Monads in which  computations may be embedded. E Any monad built by applying a sequence of monad transformers to the  * monad will be an instance of this class. >Instances should satisfy the following laws, which state that    is a transformer of monads:    .  =    (m >>= f) =   m >>= (  . f) Lift a computation from the  monad.     portable experimentallibraries@haskell.org $The continuation monad transformer. :Can be used to add continuation handling to other monads. Continuation monad. Cont r a; is a CPS computation that produces an intermediate result of type a5 within a CPS computation whose final result type is r. The returnC function simply creates a continuation which passes the value on. The >>=? operator adds the bound function into the continuation chain. DRuns a CPS computation, returns its result after applying the final  continuation to it. continuation computation (Cont). 'the final continuation, which produces  the final result (often ). callCC5 (call-with-current-continuation) calls its argument = function, passing it the current continuation. It provides < an escape continuation mechanism for use with continuation > monads. Escape continuations one allow to abort the current = computation and return a value immediately. They achieve a  similar effect to $Control.Monad.Trans.Error.throwError  and $Control.Monad.Trans.Error.catchError within an   Control.Monad.Trans.Error.ErrorT monad. The advantage of this  function over calling # is that it makes the continuation 9 explicit, allowing more flexibility and better control. The standard idiom used with callCC# is to provide a lambda-expression H to name the continuation. Then calling the named continuation anywhere G within its scope will escape from the computation, even if it is many ) layers deep within nested computations.  ask local yields a local function for   r m.    portable experimentallibraries@haskell.orgKThe error monad transformer. It can be used to add error handling to other monads. The ErrorT3 Monad structure is parameterized over two things:  e - The error type.  m - The inner monad. Here are some examples of use: . -- wraps IO action that can throw an error e & type ErrorWithIO e a = ErrorT e IO a  ==> ErrorT (IO (Either e a))  0 -- IO monad wrapped in StateT inside of ErrorT ; type ErrorAndStateWithIO e s a = ErrorT e (StateT s IO) a ' ==> ErrorT (StateT s IO (Either e a)) . ==> ErrorT (StateT (s -> IO (Either e a,s))) 5Workaround so that we can have a Haskell 98 instance  . An exception to be thrown. Minimal complete definition:  or  . (Creates an exception without a message.  The default implementation is   "". %Creates an exception with a message.  The default implementation of   s is . !"Signal an error #Handle an error $Lift a callCC operation to the new monad. %Lift a listen operation to the new monad. &Lift a pass operation to the new monad. $A string can be thrown as an error.  !"#$%& !"#$%&  !"#$%&portable experimentallibraries@haskell.org'JThe trivial monad transformer, which maps a monad to an equivalent monad. ()*)Lift a unary operation to the new monad. *Lift a binary operation to the new monad. +Lift a callCC operation to the new monad. ,Lift a  catchError operation to the new monad. '()*+,'()*,+'()()*+, portable experimentallibraries@haskell.org-1Parameterizable list monad, with an inner monad. Note:G this does not yield a monad unless the argument monad is commutative. ./01Lift a callCC operation to the new monad. 2Lift a  catchError operation to the new monad. -./012-./012-././012 portable experimentallibraries@haskell.org34567Lift a callCC operation to the new monad. 8Lift a  catchError operation to the new monad. 9Lift a listen operation to the new monad. :Lift a pass operation to the new monad. 3456789:3456789:345456789: portable experimentallibraries@haskell.org;The reader monad transformer, 8 which adds a read-only environment to the given monad. The ) function ignores the environment, while >>= passes 4 the inherited environment to both subcomputations. <=>The underlying computation, as a function of the environment. >"The parameterizable reader monad. 4Computations are functions of a shared environment. The ) function ignores the environment, while >>= passes 4 the inherited environment to both subcomputations. ?2Constructor for computations in the reader monad. @Runs a Reader' and extracts the final value from it. A Reader to run. An initial environment. A"Transform the value returned by a Reader. B0Execute a computation in a modified environment  (a specialization of D). (The function to modify the environment. 0Computation to run in the modified environment. C#Transform the computation inside a ReaderT. D0Execute a computation in a modified environment  (a more general version of F). (The function to modify the environment. 0Computation to run in the modified environment. E$Fetch the value of the environment. F0Execute a computation in a modified environment  (a specialization of D). (The function to modify the environment. 0Computation to run in the modified environment. G0Retrieve a function of the current environment. 3The selector function to apply to the environment. HLift a callCC operation to the new monad. callCC on the argument monad. ILift a  catchError operation to the new monad. catch on the argument monad. Computation to attempt. Exception handler. ;<=>?@ABCDEFGHI>?@AB;<=CDEFGHI;<=<=>?@ABCDEFGHI portable experimentallibraries@haskell.orgJKLMNOPQRSTUVWXYZ[\]^_`abMonadic state transformer. 7Maps an old state to a new state inside a state monad. $ The old state is thrown away. cBGets specific component of the state, using a projection function  supplied. dUniform lifting of a callCC operation to the new monad. ? This version rolls back to the original state on entering the  continuation. eIn-situ lifting of a callCC operation to the new monad. C This version uses the current state on entering the continuation. fLift a  catchError operation to the new monad. JKLMNOPQRSTUVWXYZ[\]^_`abcdefMNOPQRSJKLTUVWXYZ[\]^_`abcdefJKLKLMNOPQRSTUVWXYZ[\]^_`abcdefportable experimentallibraries@haskell.orgJKLMNOPQRSTUVWXYZ[\]^_`abcdef portable experimentallibraries@haskell.orgghijklmnopqrstuvwxyz{|}~Monadic state transformer. 7Maps an old state to a new state inside a state monad. $ The old state is thrown away. BGets specific component of the state, using a projection function  supplied. Uniform lifting of a callCC operation to the new monad. ? This version rolls back to the original state on entering the  continuation. In-situ lifting of a callCC operation to the new monad. C This version uses the current state on entering the continuation. Lift a  catchError operation to the new monad. ghijklmnopqrstuvwxyz{|}~jklmnopghiqrstuvwxyz{|}~ghihijklmnopqrstuvwxyz{|}~portable experimentallibraries@haskell.org9A parameterizable state monad for encapsulating an inner  monad. =The StateT Monad structure is parameterized over two things:  s - The state.  m - The inner monad. Here are some examples of use: !(Parser from ParseLib with Hugs)  % type Parser a = StateT String [] a ) ==> StateT (String -> [(a,String)]) %For example, item can be written as:  item = do (x:xs) <- get  put xs  return x  . type BoringState s a = StateT s Identity a ) ==> StateT (s -> Identity (a,s))  ( type StateWithIO s a = StateT s IO a # ==> StateT (s -> IO (a,s))  , type StateWithErr s a = StateT s Maybe a & ==> StateT (s -> Maybe (a,s)) $A parameterizable state monad where s is the type of the state  to carry. 5Construct a state monad computation from a function.  (The inverse of .) pure state transformer %equivalent state-passing computation 0Unwrap a state monad computation as a function.  (The inverse of .) %state-passing computation to execute initial state return value and final state :Evaluate a state computation with the given initial state 9 and return the final value, discarding the final state.  m s =  ( m s)%state-passing computation to execute initial value &return value of the state computation :Evaluate a state computation with the given initial state 9 and return the final state, discarding the final value.  m s =  ( m s)%state-passing computation to execute initial value  final state BMap a stateful computation from one (return value, state) pair to D another. For instance, to convert numberTree from a function that C returns a tree to a function that returns the sum of the numbered D tree (see the Examples section for numberTree and sumTree) you may  write: < sumNumberedTree :: (Eq a) => Tree a -> State (Table a) Int K sumNumberedTree = mapState (\ (t, tab) -> (sumTree t, tab)) . numberTree BApply this function to this state and return the resulting state. :Evaluate a state computation with the given initial state 9 and return the final value, discarding the final state.  m s =   ( m s):Evaluate a state computation with the given initial state 9 and return the final state, discarding the final value.  m s =   ( m s)BMap a stateful computation from one (return value, state) pair to D another. For instance, to convert numberTree from a function that C returns a tree to a function that returns the sum of the numbered D tree (see the Examples section for numberTree and sumTree) you may  write: < sumNumberedTree :: (Eq a) => Tree a -> State (Table a) Int K sumNumberedTree = mapState (\ (t, tab) -> (sumTree t, tab)) . numberTree BApply this function to this state and return the resulting state. 7Fetch the current value of the state within the monad.  s$ sets the state within the monad to s. Monadic state transformer. 7Maps an old state to a new state inside a state monad. $ The old state is thrown away. CGet a specific component of the state, using a projection function  supplied. Uniform lifting of a callCC operation to the new monad. ? This version rolls back to the original state on entering the  continuation. In-situ lifting of a callCC operation to the new monad. C This version uses the current state on entering the continuation. 6 It does not satisfy the laws of a monad transformer. Lift a  catchError operation to the new monad. Lift a listen operation to the new monad. Lift a pass operation to the new monad. portable experimentallibraries@haskell.orgportable experimentallibraries@haskell.org9A parameterizable state monad for encapsulating an inner  monad. =The StateT Monad structure is parameterized over two things:  s - The state.  m - The inner monad. Here are some examples of use: !(Parser from ParseLib with Hugs)  % type Parser a = StateT String [] a ) ==> StateT (String -> [(a,String)]) %For example, item can be written as:  item = do (x:xs) <- get  put xs  return x  . type BoringState s a = StateT s Identity a ) ==> StateT (s -> Identity (a,s))  ( type StateWithIO s a = StateT s IO a # ==> StateT (s -> IO (a,s))  , type StateWithErr s a = StateT s Maybe a & ==> StateT (s -> Maybe (a,s)) $A parameterizable state monad where s is the type of the state  to carry and a is the type of the  return value. 5Construct a state monad computation from a function.  (The inverse of .) 0Unwrap a state monad computation as a function.  (The inverse of .) @Evaluate this state monad with the given initial state,throwing ' away the final state. Very much like fst composed with  runstate. The state to evaluate An initial value *The return value of the state application ?Execute this state and return the new state, throwing away the  return value. Very much like snd composed with  runstate. The state to evaluate An initial value The new state BMap a stateful computation from one (return value, state) pair to D another. For instance, to convert numberTree from a function that C returns a tree to a function that returns the sum of the numbered D tree (see the Examples section for numberTree and sumTree) you may  write: < sumNumberedTree :: (Eq a) => Tree a -> State (Table a) Int K sumNumberedTree = mapState (\ (t, tab) -> (sumTree t, tab)) . numberTree BApply this function to this state and return the resulting state. :Evaluate a state computation with the given initial state 9 and return the final value, discarding the final state.  m s =   ( m s):Evaluate a state computation with the given initial state 9 and return the final state, discarding the final value.  m s =   ( m s)BMap a stateful computation from one (return value, state) pair to D another. For instance, to convert numberTree from a function that C returns a tree to a function that returns the sum of the numbered D tree (see the Examples section for numberTree and sumTree) you may  write: < sumNumberedTree :: (Eq a) => Tree a -> State (Table a) Int K sumNumberedTree = mapState (\ (t, tab) -> (sumTree t, tab)) . numberTree BApply this function to this state and return the resulting state. Monadic state transformer. 7Maps an old state to a new state inside a state monad. $ The old state is thrown away. BGets specific component of the state, using a projection function  supplied. Uniform lifting of a callCC operation to the new monad. ? This version rolls back to the original state on entering the  continuation. In-situ lifting of a callCC operation to the new monad. C This version uses the current state on entering the continuation. 6 It does not satisfy the laws of a monad transformer. Lift a  catchError operation to the new monad. Lift a listen operation to the new monad. Lift a pass operation to the new monad. portable experimentallibraries@haskell.orgLift a callCC operation to the new monad. Lift a  catchError operation to the new monad. portable experimentallibraries@haskell.orgportable experimentallibraries@haskell.orgLift a callCC operation to the new monad. Lift a  catchError operation to the new monad.  !"#$%&'()**+,-./012345677894: ; ; < = 4 : > > ? @ 4 : 5 6 A A B C D E F G H I J K L 4 : M M N O P Q R S T U V W X Y J K L Z [ \ ] ^ _ ` a b 4 c : M M N O P Q R S T U V W X Y J K L Z [ \ ] ^ _ ` a b 4 c :ddefghijklmnop_`ab4c:56ddefghijklmnop_`ab4c:56qqrstuvwxyZ[\]^4:qqrstuvwxyZ[\]^4:z{|}~z{z{ zzztransformers-0.2.0.0Data.Functor.ConstantData.Functor.ComposeData.Functor.IdentityControl.Monad.Trans.ClassControl.Monad.IO.ClassControl.Monad.Trans.ContControl.Monad.Trans.ErrorControl.Monad.Trans.IdentityControl.Monad.Trans.ListControl.Monad.Trans.MaybeControl.Monad.Trans.ReaderControl.Monad.Trans.RWS.LazyControl.Monad.Trans.RWS.StrictControl.Monad.Trans.State.Lazy Control.Monad.Trans.State.StrictControl.Monad.Trans.Writer.Lazy!Control.Monad.Trans.Writer.StrictControl.Monad.Trans.RWSControl.Monad.Trans.StateControl.Monad.Trans.WriterConstant getConstantCompose getComposeIdentity runIdentity MonadTransliftMonadIOliftIOContTrunContTContcontrunContmapContwithContmapContT withContTcallCC liftLocalErrorT runErrorT ErrorListlistMsgErrornoMsgstrMsg mapErrorT throwError catchError liftCallCC liftListenliftPass IdentityT runIdentityT mapIdentityT liftCatchListTrunListTmapListTMaybeT runMaybeT mapMaybeTReaderT runReaderTReaderreader runReader mapReader withReader mapReaderT withReaderTasklocalasksRWSTrunRWSTRWSrwsrunRWSevalRWSexecRWSmapRWSwithRWSevalRWSTexecRWSTmapRWSTwithRWSTtelllistenpasslistenscensorgetputmodifygets liftCallCC'StateT runStateTStatestaterunState evalState execStatemapState withState evalStateT execStateT mapStateT withStateTWriterT runWriterTWriterwriter runWriter execWriter mapWriter execWriterT mapWriterTbaseGHC.Basereturnghc-prim GHC.TypesIOidString $fError[]lift2IdentityT liftReaderT Data.Tuplefstsnd Control.MonadliftM