*ڳ      ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L MNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~portable experimentallibraries@haskell.org Safe-InferedIdentity wrapper. &Abstraction for wrapping up a object. &If you have an monadic function, say:  " example :: Int -> Identity Int  example x = return (x*x) you can "run" it, using   Main> runIdentity (example 42)  1764 :: Int 9A typical use of the Identity monad is to derive a monad from a monad transformer.   -- derive the  monad using the  monad transformer type  s a =  s  a The 9 label is used in the type definition because it follows Ga style of monad definition that explicitly represents monad values as Qcomputations. In this style, a monadic computation is built up using the monadic =operators and then the value of the computation is extracted  using the  run****** function.  Because the Identity3 monad does not do any computation, its definition  is trivial. -For a better example of this style of monad, see the  monad. /;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Infered+non-portable (multi-parameter type classes) experimentallibraries@haskell.org Safe-Infered AThe strategy of combining computations that can throw exceptions by bypassing bound functions Gfrom the point an exception is thrown to the point that it is handled. 8Is parameterized over the type of error information and the monad type constructor. It is common to use  String as the monad type constructor Ifor an error monad in which error descriptions take the form of strings. PIn that case and many other common cases the resulting monad is already defined as an instance of the   class. +You can also define your own error type and/ or use a monad type constructor  other than  String or  IOError. CIn these cases you will have to explicitly define instances of the   and/or   classes. DIs used within a monadic computation to begin exception processing. MA handler function to handle previous errors and return to normal execution.  A common idiom is:  7 do { action1; action2; action3 } `catchError` handler  where the action functions can call  .  Note that handler2 and the do-block must have the same return type. An exception to be thrown. + An instance must redefine at least one of  , . (Creates an exception without a message.  Default implementation is  "". %Creates an exception with a message.  Default implementation is  . $A string can be thrown as an error.        ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Inferedget4 returns the state from the internals of the monad. put& replaces the state inside the monad. Monadic state transformer. 7Maps an old state to a new state inside a state monad. $ The old state is thrown away.  + Main> :t modify ((+1) :: Int -> Int) 1 modify (...) :: (MonadState Int a) => a () This says that  modify (+1) acts over any " Monad that is a member of the  MonadState class,  with an Int state. BGets specific component of the state, using a projection function  supplied. ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-InferedSee examples in Control.Monad.Reader. *Note, the partially applied function type (->) r is a simple reader monad. See the instance declaration below. !Retrieves the monad environment. >Executes a computation in a modified environment. Parameters: ) The function to modify the environment.  Reader to run.  The resulting Reader. =Retrieves a function of the current environment. Parameters: 4 The selector function to apply to the environment. See an example in Control.Monad.Reader. ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Inferedportable experimentallibraries@haskell.org Safe-Infered+non-portable (multi-parameter type classes) experimentallibraries@haskell.org Safe-InferedcallCC" (call-with-current-continuation) D calls a function with the current continuation as its argument. P Provides an escape continuation mechanism for use with Continuation monads. K Escape continuations allow to abort the current computation and return  a value immediately. % They achieve a similar effect to    and    within an   monad. , Advantage of this function over calling return is that it makes  the continuation explicit, 1 allowing more flexibility and better control  (see examples in Control.Monad.Cont). The standard idiom used with callCC# is to provide a lambda-expression K to name the continuation. Then calling the named continuation anywhere 7 within its scope will escape from the computation, ? even if it is many layers deep within nested computations.  ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-InferedThe reader monad transformer. FCan be used to add environment reading functionality to other monads. ""The parameterizable reader monad. The return function creates a Reader that ignores the environment, and produces the given value. The binding operator >>= produces a Reader that uses the environment )to extract the value its left-hand side, Kand then applies the bound function to that value in the same environment. $Runs Reader' and extracts the final value from it.  To extract the value apply (runReader reader) to an environment value.  Parameters:  A Reader to run.  An initial environment. &A more general version of .  !"#$%&'(> !"#$%&'( "#$%& !'( !"#$%&'( +non-portable (multi-parameter type classes) experimentallibraries@haskell.org Safe-Infered)KThe 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))) 0Note: this instance does not satisfy the second  law  v >> mzero = mzero )*+,: )*+,)*+,)*+, +non-portable (multi-parameter type classes) experimentallibraries@haskell.org Safe-Infered -./01-./0-./0 -./0 ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Infered!123456789:;<=>k     123456789:;<=>456789:123;<=>123456789:;<=>;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Inferedk     123456789:;<=> ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Infered!?@ABCDEFGHIJKL !"#$k     ?@ABCDEFGHIJKLBCDEFGH?@AIJKL?@ABCDEFGHIJKL !"#$;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Infered M9A 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 Indentity 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)) P$A parameterizable state monad where s is the type of the state  to carry and a is the type of the  return value. S@Evaluate this state monad with the given initial state,throwing ' away the final state. Very much like fst composed with  runstate. T?Execute this state and return the new state, throwing away the  return value. Very much like snd composed with  runstate. UBMap 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 VBApply this function to this state and return the resulting state. W Similar to S X Similar to T Y Similar to U Z Similar to V MNOPQRSThe state to evaluate An initial value *The return value of the state application TThe state to evaluate An initial value The new state UVWXYZ%&'()*+,-./0123CMNOPQRSTUVWXYZPQRSTUVMNOWXYZMNOPQRSTUVWXYZ%&'()*+,-./0123;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-InferedCMNOPQRSTUVWXYZ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Infered [9A 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 Indentity 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. a@Evaluate this state monad with the given initial state,throwing ' away the final state. Very much like fst composed with  runstate. b?Execute this state and return the new state, throwing away the  return value. Very much like snd composed with  runstate. cBMap 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 dBApply this function to this state and return the resulting state. e Similar to a f Similar to b g Similar to c h Similar to d [\]^_`aThe state to evaluate An initial value *The return value of the state application bThe state to evaluate An initial value The new state cdefgh456789:;<=>?@ABC[\]^_`abcdefgh^_`abcd[\]efgh[\]^_`abcdefgh456789:;<=>?@AB;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-InferedijklmnopqrCDEFGHIJKLMNOPQ]     ijklmnopqr lmnopijkqrijklmnopqrCDEFGHIJKLMNOPQ;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Infered]     ijklmnopqr;non-portable (multi-param classes, functional dependencies) experimentallibraries@haskell.org Safe-Inferedstuvwxyz{|RSTUVWXYZ[\]^_`]     stuvwxyz{| vwxyzstu{|stuvwxyz{|RSTUVWXYZ[\]^_`+non-portable (multi-parameter type classes) experimentallibraries@haskell.org Safe-Infered}$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. :Runs a CPS computation, returns its result after applying " the final continuation to it.  Parameters:  a continuation computation (Cont). @ the final continuation, which produces the final result (often id). }~abcdefghij9}~ }~}~abcdefghijk !"#$%&'()*+,-./01234567 8 8 9 : : ; < = > ? @ @ A B C C D E F F G H H I J K L M N O P Q F F G H H I J K L M N O P QRSTUVWXYZ[RSTUVWXYZ[\\]^^_`abc\\]^^_`abcddeffghijklmnopqopropsoptopuovwoxyoxzop{op|ov}ox~ooxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox ooooooooooooooooooooooooooooo            mtl-1.1.1.1Control.Monad.IdentityControl.Monad.Writer.ClassControl.Monad.Error.ClassControl.Monad.State.ClassControl.Monad.Reader.ClassControl.Monad.RWS.ClassControl.Monad.TransControl.Monad.Cont.ClassControl.Monad.ReaderControl.Monad.ErrorControl.Monad.ListControl.Monad.RWS.LazyControl.Monad.RWS.StrictControl.Monad.State.LazyControl.Monad.State.StrictControl.Monad.Writer.LazyControl.Monad.Writer.StrictControl.Monad.ContControl.Monad.StateStateStateTDataEither throwError catchErrorErrorControl.Monad.RWSControl.Monad.WriterIdentity runIdentity MonadWritertelllistenpasslistenscensor MonadErrornoMsgstrMsg MonadStategetputmodifygets MonadReaderasklocalasksMonadRWSMonadIOliftIO MonadTranslift MonadContcallCCReaderT runReaderTReader runReader mapReader withReader mapReaderT withReaderTErrorT runErrorT mapErrorTListTrunListTmapListTRWSTrunRWSTRWSrunRWSevalRWSexecRWSmapRWSwithRWSevalRWSTexecRWSTmapRWSTwithRWST runStateTrunState evalState execStatemapState withState evalStateT execStateT mapStateT withStateTWriterT runWriterTWriter runWriter execWriter mapWriter execWriterT mapWriterTContTrunContTContrunContmapContwithContmapContT withContT$fMonadFixIdentity$fMonadIdentity$fFunctorIdentitybaseGHC.Basefail>>=>>fmapreturnControl.Monad.Fixmfix Control.MonadguardliftMMonadFunctorMonadFix MonadPlus Data.FunctionfixmfilterapliftM5liftM4liftM3liftM2unlesswhen replicateM_ replicateMfoldM_foldM zipWithM_zipWithM mapAndUnzipMjoinvoidforever<=<>=>msumforM_forMfilterMmapM_mapM sequence_sequence=<<mplusmzero $fError[]$fErrorIOException$fMonadReaderr(->) $fMonadIOIO$fMonadWriterwReaderT$fMonadStatesReaderT$fMonadErroreReaderT$fMonadContReaderT$fMonadIOReaderT$fMonadTransReaderT$fMonadReaderrReaderT$fMonadFixReaderT$fMonadPlusReaderT$fMonadReaderT$fFunctorReaderT$fMonadReaderrReader$fMonadFixReader $fMonadReader$fFunctorReader $fMonadPlusIO$fMonadWriterwErrorT$fMonadStatesErrorT$fMonadReaderrErrorT$fMonadRWSrwsErrorT$fMonadContErrorT$fMonadIOErrorT$fMonadTransErrorT$fMonadErroreErrorT$fMonadFixErrorT$fMonadPlusErrorT $fMonadErrorT$fFunctorErrorT$fMonadErroreEither$fMonadPlusEither$fMonadErrorIOExceptionIO$fMonadStatesListT$fMonadReadersListT$fMonadErroreListT$fMonadContListT$fMonadIOListT$fMonadTransListT$fMonadPlusListT $fMonadListT$fFunctorListT$fMonadErroreRWST$fMonadContRWST $fMonadIORWST$fMonadTransRWST$fMonadRWSrwsRWST$fMonadStatesRWST$fMonadWriterwRWST$fMonadReaderrRWST$fMonadFixRWST$fMonadPlusRWST $fMonadRWST $fFunctorRWST$fMonadRWSrwsRWS$fMonadStatesRWS$fMonadWriterwRWS$fMonadReaderrRWS $fMonadFixRWS $fMonadRWS $fFunctorRWS Data.Monoid<>mconcatmappendmemptyMonoidgetDualDualappEndoEndogetAllAllgetAnyAnygetSumSum getProductProductgetFirstFirstgetLastLast$fMonadWriterwStateT$fMonadReaderrStateT$fMonadErroreStateT$fMonadContStateT$fMonadIOStateT$fMonadTransStateT$fMonadStatesStateT$fMonadFixStateT$fMonadPlusStateT $fMonadStateT$fFunctorStateT$fMonadStatesState$fMonadFixState $fMonadState$fFunctorState$fMonadStatesWriterT$fMonadReaderrWriterT$fMonadErroreWriterT$fMonadContWriterT$fMonadIOWriterT$fMonadTransWriterT$fMonadWriterwWriterT$fMonadFixWriterT$fMonadPlusWriterT$fMonadWriterT$fFunctorWriterT$fMonadWriterwWriter$fMonadFixWriter $fMonadWriter$fFunctorWriter$fMonadStatesContT$fMonadReaderr'ContT$fMonadIOContT$fMonadTransContT$fMonadContContT $fMonadContT$fFunctorContT$fMonadContCont $fMonadCont $fFunctorCont