.c .      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'()*+,-a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe*+Monads in which .e computations may be embedded. 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.00a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,aThe class of monad transformers. Instances should satisfy the following laws, which state that  is a monad transformation:  . / = /  (m >>= f) =  m >>= ( . f)DLift a computation from the argument monad to the constructed monad."(c) The University of Glasgow 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe'+,>^The continuation monad transformer. Can be used to add continuation handling to other monads.Continuation monad. Cont r aC is a CPS computation that produces an intermediate result of type a5 within a CPS computation whose final result type is r.The returnB function simply creates a continuation which passes the value on.The >>=> operator adds the bound function into the continuation chain.OConstruct a continuation-passing computation from a function. (The inverse of  ) ZThe result of running a CPS computation with a given final continuation. (The inverse of ) UThe result of running a CPS computation with the identity as the final continuation.   (/ x) = x PApply a function to transform the result of a continuation-passing computation.   (  f m) = f .   m LApply a function to transform the continuation passed to a CPS computation.   (  f m) =   m . f   m" delimits the continuation of any  inside m.   (/ m) = / m f8 captures the continuation up to the nearest enclosing   and passes it to f:   ( f >>= k) =   (f (  . k))-The result of running a CPS computation with / as the final continuation.  ( m) = mPApply a function to transform the result of a continuation-passing computation.  ( f m) = f .  mLApply a function to transform the continuation passed to a CPS computation.  ( f m) =  m . fcallCC< (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   and   within an  6 monad. The advantage of this function over calling /[ is that it makes the continuation explicit, allowing more flexibility and better control.The standard idiom used with callCC is to provide a lambda-expression to name the continuation. Then calling the named continuation anywhere within its scope will escape from the computation, even if it is many layers deep within nested computations. m" delimits the continuation of any  inside m.  ( m) =  m f8 captures the continuation up to the nearest enclosing  and passes it to f:  ( f >>= k) =  (f ( . k)) ask local yields a local function for  r m. continuation computation (Cont).@the final continuation, which produces the final result (often 1). 23456   23456(c) Ross Paterson 2012 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe'>Signature of the pass operation, introduced in Control.Monad.Trans.Writer. Any lifting function liftPass should satisfy lift . liftPass = liftPass . liftSignature of the listen operation, introduced in Control.Monad.Trans.Writer. Any lifting function  liftListen should satisfy lift . liftListen = liftListen . liftSignature of the catchE operation, introduced in Control.Monad.Trans.Except. Any lifting function  liftCatch should satisfy lift (cf m f) = liftCatch (lift . cf) (lift f)Signature of the callCC operation, introduced in Control.Monad.Trans.Cont. Any lifting function  liftCallCC should satisfy lift (f k) = f' (lift . k) => lift (cf f) = liftCallCC cf f'a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe'+,> UThe reader monad transformer, which adds a read-only environment to the given monad.The /) function ignores the environment, while >>=; passes the inherited environment to both subcomputations.!The parameterizable reader monad.3Computations are functions of a shared environment.The /) function ignores the environment, while >>=; passes the inherited environment to both subcomputations.@Constructor for computations in the reader monad (equivalent to &).Runs a Reader8 and extracts the final value from it. (The inverse of .) "Transform the value returned by a Reader.  (  f m) = f .  m!FExecute a computation in a modified environment (a specialization of #).  (! f m) =  m . f"#Transform the computation inside a ReaderT.  (" f m) = f .  m#LExecute a computation in a modified environment (a more general version of %).  (# f m) =  m . f$#Fetch the value of the environment.%FExecute a computation in a modified environment (a specialization of #).  (% f m) =  m . f&/Retrieve a function of the current environment. & f = 7 f $'Lift a callCC operation to the new monad.(Lift a catchE operation to the new monad.A Reader to run.An initial environment. !'The function to modify the environment./Computation to run in the modified environment."#'The function to modify the environment./Computation to run in the modified environment.8$%'The function to modify the environment./Computation to run in the modified environment.&2The selector function to apply to the environment.'(9:;<=>?@A !"#$%&'( !"#$%&'( !"#8$%&'(9:;<=>?@Aa(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,):A monad transformer adding reading an environment of type r , collecting an output of type w and updating a state of type s to an inner monad m.,*A monad containing an environment of type r, output of type w! and an updatable state of type s.-?Construct an RWS computation from a function. (The inverse of ..).:Unwrap an RWS computation as a function. (The inverse of -.)/Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.0Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.1XMap the return value, final state and output of a computation using the given function. . (1 f m) r s = f (. m r s)22 f m executes action m= with an initial environment and state modified by applying f. . (2 f m) r s = B (. m) (f r s)3Evaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.4Evaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.53Map the inner computation using the given function. + (5 f m) r s = f (+ m r s)66 f m executes action m= with an initial environment and state modified by applying f. + (6 f m) r s = B (+ m) (f r s)7@Constructor for computations in the reader monad (equivalent to :).8#Fetch the value of the environment.9/Execute a computation in a modified environment + (9 f m) r s = + m (f r) s:/Retrieve a function of the current environment. : f = 7 f 8;<Construct a writer computation from a (result, output) pair.<< w' is an action that produces the output w.== m' is an action that executes the action m6 and adds its output to the value of the computation. + (= m) r s = 7 (\ (a, w) -> ((a, w), w)) (+ m r s)>> f m' is an action that executes the action m" and adds the result of applying f/ to the output to the value of the computation. > f m = 7 (id *** f) (= m) + (> f m) r s = 7 (\ (a, w) -> ((a, f w), w)) (+ m r s)?? m' is an action that executes the action me, which returns a value and a function, and returns the value, applying the function to the output. + (? m) r s = 7 (\ ((a, f), w) -> (a, f w)) (+ m r s)@@ f m' is an action that executes the action m and applies the function f4 to its output, leaving the return value unchanged. @ f m = ? (7 (\ x -> (x,f)) m) + (@ f m) r s = 7 (\ (a, w) -> (a, f w)) (+ m r s)AFConstruct a state monad computation from a state transformer function.B6Fetch the current value of the state within the monad.CC s$ sets the state within the monad to s.DD f@ is an action that updates the state to the result of applying f to the current state. D f = B >>= (C . f)EMGet a specific component of the state, using a projection function supplied. E f = 7 f BFUniform lifting of a callCCj operation to the new monad. This version rolls back to the original state on entering the continuation.GIn-situ lifting of a callCC_ operation to the new monad. This version uses the current state on entering the continuation.HLift a catchE operation to the new monad.()*+,-./RWS computation to executeinitial environment initial valuefinal value and output0RWS computation to executeinitial environment initial valuefinal state and output123computation to executeinitial environment initial value+computation yielding final value and output4computation to executeinitial environment initial value+computation yielding final state and output56789:;<=>?@ABCDEFGHCDEFGHIJ )*+,-./0123456789:;<=>?@ABCDEFGH ,-./012)*+3456789:;<=>?@ABCDEFGH&)*+,-./0123456789:;<=>?@ABCDEFGHCDEFGHIJa(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe )*+,-./0123456789:;<=>?@ABCDEFGHa(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,I:A monad transformer adding reading an environment of type r , collecting an output of type w and updating a state of type s to an inner monad m.L*A monad containing an environment of type r, output of type w! and an updatable state of type s.M?Construct an RWS computation from a function. (The inverse of N.)N:Unwrap an RWS computation as a function. (The inverse of M.)OEvaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.PEvaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.QXMap the return value, final state and output of a computation using the given function. N (Q f m) r s = f (N m r s)RR f m executes action m= with an initial environment and state modified by applying f. N (R f m) r s = B (N m) (f r s)SEvaluate a computation with the given initial state and environment, returning the final value and output, discarding the final state.TEvaluate a computation with the given initial state and environment, returning the final state and output, discarding the final value.U3Map the inner computation using the given function. K (U f m) r s = f (K m r s)VV f m executes action m= with an initial environment and state modified by applying f. K (V f m) r s = B (K m) (f r s)W@Constructor for computations in the reader monad (equivalent to Z).X#Fetch the value of the environment.Y/Execute a computation in a modified environment K (Y f m) r s = K m (f r) sZ/Retrieve a function of the current environment. Z f = 7 f X[<Construct a writer computation from a (result, output) pair.\\ w' is an action that produces the output w.]] m' is an action that executes the action m6 and adds its output to the value of the computation. K (] m) r s = 7 (\ (a, w) -> ((a, w), w)) (K m r s)^^ f m' is an action that executes the action m" and adds the result of applying f/ to the output to the value of the computation. ^ f m = 7 (id *** f) (] m) K (^ f m) r s = 7 (\ (a, w) -> ((a, f w), w)) (K m r s)__ m' is an action that executes the action me, which returns a value and a function, and returns the value, applying the function to the output. K (_ m) r s = 7 (\ ((a, f), w) -> (a, f w)) (K m r s)`` f m' is an action that executes the action m and applies the function f4 to its output, leaving the return value unchanged. ` f m = _ (7 (\ x -> (x,f)) m) K (` f m) r s = 7 (\ (a, w) -> (a, f w)) (K m r s)aFConstruct a state monad computation from a state transformer function.b6Fetch the current value of the state within the monad.cc s$ sets the state within the monad to s.dd f@ is an action that updates the state to the result of applying f to the current state. d f = b >>= (c . f)eMGet a specific component of the state, using a projection function supplied. e f = 7 f bfUniform lifting of a callCCj operation to the new monad. This version rolls back to the original state on entering the continuation.gIn-situ lifting of a callCC_ operation to the new monad. This version uses the current state on entering the continuation.hLift a catchE operation to the new monad.(IJKLMNORWS computation to executeinitial environment initial valuefinal value and outputPRWS computation to executeinitial environment initial valuefinal state and outputQRScomputation to executeinitial environment initial value+computation yielding final value and outputTcomputation to executeinitial environment initial value+computation yielding final state and outputUVWXYZ[\]^_`abcdefghKLMNOPQR IJKLMNOPQRSTUVWXYZ[\]^_`abcdefgh LMNOPQRIJKSTUVWXYZ[\]^_`abcdefgh&IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghKLMNOPQRa(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,i+A state transformer monad parameterized by:s - The state.m - The inner monad.The /, function leaves the state unchanged, while >>=T uses the final state of the first computation as the initial state of the second.l(A state monad parameterized by the type s of the state to carry.The /, function leaves the state unchanged, while >>=T uses the final state of the first computation as the initial state of the second.mFConstruct a state monad computation from a function. (The inverse of n.)nAUnwrap a state monad computation as a function. (The inverse of m.)orEvaluate a state computation with the given initial state and return the final value, discarding the final state. o m s = S (n m s)prEvaluate a state computation with the given initial state and return the final state, discarding the final value. p m s = T (n m s)qUMap both the return value and final state of a computation using the given function. n (q f m) = f . n mrr f m executes action m" on a state modified by applying f. r f m = y f >> msrEvaluate a state computation with the given initial state and return the final value, discarding the final state. s m s = 7 S (k m s)trEvaluate a state computation with the given initial state and return the final state, discarding the final value. t m s = 7 T (k m s)uUMap both the return value and final state of a computation using the given function. k (u f m) = f . k mvv f m executes action m" on a state modified by applying f. v f m = y f >> mw6Fetch the current value of the state within the monad.xx s$ sets the state within the monad to s.yy f@ is an action that updates the state to the result of applying f to the current state. y f = w >>= (x . f)z A variant of y6 in which the computation is strict in the new state. z f = w >>= ((U) x . f){MGet a specific component of the state, using a projection function supplied. { f = 7 f w|Uniform lifting of a callCCj 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. This version uses the current state on entering the continuation. It does not satisfy the uniformity property (see Control.Monad.Signatures).~Lift a catchE operation to the new monad.Lift a listen operation to the new monad.Lift a pass operation to the new monad. ijklmpure state transformer$equivalent state-passing computationn$state-passing computation to execute initial statereturn value and final stateo$state-passing computation to execute initial value%return value of the state computationp$state-passing computation to execute initial value final stateqrstuvwxyz{|}~VWXYZ[\]ijklmnopqrstuvwxyz{|}~lmnopqrijkstuvwxyz{|}~ijklmnopqrstuvwxyz{|}~VWXYZ[\]a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafeijklmnopqrstuvwxyz{|}~ a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,+A state transformer monad parameterized by:s - The state.m - The inner monad.The /, function leaves the state unchanged, while >>=T uses the final state of the first computation as the initial state of the second.(A state monad parameterized by the type s of the state to carry.The /, function leaves the state unchanged, while >>=T uses the final state of the first computation as the initial state of the second.FConstruct a state monad computation from a function. (The inverse of .)AUnwrap a state monad computation as a function. (The inverse of .)rEvaluate a state computation with the given initial state and return the final value, discarding the final state.  m s = S ( m s)rEvaluate a state computation with the given initial state and return the final state, discarding the final value.  m s = T ( m s)UMap both the return value and final state of a computation using the given function.  ( f m) = f .  m f m executes action m" on a state modified by applying f.  f m =  f >> mrEvaluate a state computation with the given initial state and return the final value, discarding the final state.  m s = 7 S ( m s)rEvaluate a state computation with the given initial state and return the final state, discarding the final value.  m s = 7 T ( m s)UMap both the return value and final state of a computation using the given function.  ( f m) = f .  m f m executes action m" on a state modified by applying f.  f m =  f >> m6Fetch the current value of the state within the monad. s$ sets the state within the monad to s. f@ is an action that updates the state to the result of applying f to the current state.  f =  >>= ( . f) A variant of 6 in which the computation is strict in the new state.  f =  >>= ((U)  . f)MGet a specific component of the state, using a projection function supplied.  f = 7 f Uniform lifting of a callCCj 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. This version uses the current state on entering the continuation. It does not satisfy the uniformity property (see Control.Monad.Signatures).Lift a catchE operation to the new monad.Lift a listen operation to the new monad.Lift a pass operation to the new monad. pure state transformer$equivalent state-passing computation$state-passing computation to execute initial statereturn value and final state$state-passing computation to execute initial value%return value of the state computation$state-passing computation to execute initial value final state^_`abcde^_`abcde (c) Ross Paterson 2013 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe*+(Lifting of the f# class to binary type constructors.g? function for an application of the type constructor based on g and h" functions for the argument types.h? function for an application of the type constructor based on g and hu functions for the argument types. The default implementation using standard list syntax is correct for most types.Lifting of the i# class to binary type constructors.j? function for an application of the type constructor based on j and k" functions for the argument types.k? function for an application of the type constructor based on j and ku functions for the argument types. The default implementation using standard list syntax is correct for most types.Lifting of the l# class to binary type constructors.Lift m( functions through the type constructor.The function will usually be applied to comparison functions, but the more general type ensures that the implementation uses them to compare elements of the first container with elements of the second.Lifting of the n# class to binary type constructors.1Lift equality tests through the type constructor.The function will usually be applied to equality functions, but the more general type ensures that the implementation uses them to compare elements of the first container with elements of the second.Lifting of the f" class to unary type constructors.g? function for an application of the type constructor based on g and h! functions for the argument type.h? function for an application of the type constructor based on g and ht functions for the argument type. The default implementation using standard list syntax is correct for most types.Lifting of the i" class to unary type constructors.j? function for an application of the type constructor based on j and k! functions for the argument type.k? function for an application of the type constructor based on j and kt functions for the argument type. The default implementation using standard list syntax is correct for most types.Lifting of the l" class to unary type constructors.Lift a m' function through the type constructor.The function will usually be applied to a comparison function, but the more general type ensures that the implementation uses it to compare elements of the first container with elements of the second.Lifting of the n" class to unary type constructors.3Lift an equality test through the type constructor.The function will usually be applied to an equality function, but the more general type ensures that the implementation uses it to compare elements of the first container with elements of the second.Lift the standard (o)' function through the type constructor.Lift the standard m' function through the type constructor.pWRead a list (using square brackets and commas), given a function for reading elements.Lift the standard j and k) functions through the type constructor.Lift the standard g and h) functions through the type constructor.Lift the standard (o)' function through the type constructor.Lift the standard m' function through the type constructor.Lift the standard j' function through the type constructor.Lift the standard g' function through the type constructor. p d is a parser for datatypes where each alternative begins with a data constructor. It parses the constructor and passes it to p=. Parsers for various constructors can be constructed with ,  and , and combined with mappend from the Monoid class. rp n c n'R matches the name of a unary data constructor and then parses its argument using rp. rp1 rp2 n c n'T matches the name of a binary data constructor and then parses its arguments using rp1 and rp2 respectively. sp n d xK produces the string representation of a unary data constructor with name n and argument x, in precedence context d. sp1 sp2 n d x yL produces the string representation of a binary data constructor with name n and arguments x and y, in precedence context d. n c n'R matches the name of a unary data constructor and then parses its argument using j. n c n'R matches the name of a unary data constructor and then parses its argument using . n c n'T matches the name of a binary data constructor and then parses its arguments using . n d xK produces the string representation of a unary data constructor with name n and argument x, in precedence context d. n d xK produces the string representation of a unary data constructor with name n and argument x, in precedence context d. n d x yL produces the string representation of a binary data constructor with name n and arguments x and y, in precedence context d.Lpqrstuvwxyz{|}~''@pqrstuvwxyz{|}~ (c) Ross Paterson 2010 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe'+,>Constant functor. (c) Ross Paterson 2010 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,An applicative functor that collects a monoid (e.g. lists) of errors. A sequence of computations fails if any of its components do, but unlike monads made with ExceptT from Control.Monad.Trans.ExceptI, these computations continue after an error, collecting all the errors.  f   x =  (f x)  f   e =  e  e   x =  e  e1   e2 =  (e1 <> e2)WApplicative functor formed by adding pure computations to a given applicative functor. Projection to the other functor.0Apply a transformation to the other computation.4Extractor for computations with accumulating errors.  ( x) =  x  ( e) =  eReport an error.A combination is  only either part is.A combination is  only if both parts are. (C) 2013 Ross Paterson BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,9A monad transformer that adds exceptions to other monads.ExceptT2 constructs a monad parameterized over two things:e - The exception type.m - The inner monad.The /E function yields a computation that produces the given value, while >>=@ sequences two subcomputations, exiting on the first exception.$The parameterizable exception monad.4Computations are either exceptions or normal values.The /( function returns a normal value, while >>=o exits on the first exception. For a variant that continues after an error and collects all the errors, see  .FConstructor for computations in the exception monad. (The inverse of ).DExtractor for computations in the exception monad. (The inverse of ).7Map the unwrapped computation using the given function.  ( f m) = f ( m)bTransform any exceptions thrown by the computation using the given function (a specialization of ).The inverse of .7Map the unwrapped computation using the given function.  ( f m) = f ( m)MTransform any exceptions thrown by the computation using the given function.Signal an exception value e.  ( e) = / ( e)  e >>= m =  eHandle an exception.  h ( m) =  m  h ( e) = h eLift a callCC operation to the new monad.Lift a listen operation to the new monad.Lift a pass operation to the new monad."the inner computation2a handler for exceptions in the inner computation!(c) Michael Weber <michael.weber@post.rwth-aachen.de> 2001, (c) Jeff Newbern 2003-2006, (c) Andriy Palamarchuk 2006 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+, SThe error monad transformer. It can be used to add error handling to other monads.The ErrorT2 Monad structure is parameterized over two things:e - The error type.m - The inner monad.The /1 function yields a successful computation, while >>=< sequences two subcomputations, failing on the first error.5Workaround so that we can have a Haskell 98 instance  .An exception to be thrown.Minimal complete definition:  or .GCreates an exception without a message. The default implementation is  "".DCreates an exception with a message. The default implementation of  s is .7Map the unwrapped computation using the given function.  ( f m) = f ( m)Signal an error value e.  ( e) = / ( e)  e >>= m =  eHandle an error.  h ( m) =  m  h ( e) = h eLift 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.'the inner computation.a handler for errors in the inner computation"(c) 2007 Magnus Therning BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe'+,>IThe 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 catchE operation to the new monad.a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,0Parameterizable list monad, with an inner monad.Note:F this does not yield a monad unless the argument monad is commutative. Map between  computations.  ( f m) = f ( m)Lift a callCC operation to the new monad.Lift a catchE operation to the new monad.(c) 2007 Yitzak Gale, Eric Kidd BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+,TThe parameterizable maybe monad, obtained by composing an arbitrary monad with the   monad.:Computations are actions that may produce a value or exit.The /@ function yields a computation that produces that value, while >>=D sequences two subcomputations, exiting if either computation does.#Transform the computation inside a MaybeT.  ( f m) = f ( m) Convert a  computation to ", with a default exception value. Convert a  computation to ), discarding the value of any exception.Lift a callCC operation to the new monad.Lift a catchE operation to the new monad.Lift a listen operation to the new monad.Lift a pass operation to the new monad.         a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+, A writer monad parameterized by:w - the output to accumulate.m - The inner monad.The / function produces the output , while >>=4 combines the outputs of the subcomputations using .)A writer monad parameterized by the type w of output to accumulate.The / function produces the output , while >>=4 combines the outputs of the subcomputations using .NConstruct a writer computation from a (result, output) pair. (The inverse of .)IUnwrap a writer computation as a (result, output) pair. (The inverse of .)-Extract the output from a writer computation.  m = T ( m)PMap both the return value and output of a computation using the given function.  ( f m) = f ( m)-Extract the output from a writer computation.  m = 7 T ( m)PMap both the return value and output of a computation using the given function.  ( f m) = f ( m) w' is an action that produces the output w.   m' is an action that executes the action m6 and adds its output to the value of the computation.  (  m) = 7 (\ (a, w) -> ((a, w), w)) ( m)   f m' is an action that executes the action m" and adds the result of applying f/ to the output to the value of the computation.   f m = 7 (id *** f) (  m)  (  f m) = 7 (\ (a, w) -> ((a, f w), w)) ( m)   m' is an action that executes the action me, which returns a value and a function, and returns the value, applying the function to the output.  (  m) = 7 (\ ((a, f), w) -> (a, f w)) ( m)   f m' is an action that executes the action m and applies the function f4 to its output, leaving the return value unchanged.   f m =   (7 (\ x -> (x,f)) m)  (  f m) = 7 (\ (a, w) -> (a, f w)) ( m) Lift a callCC operation to the new monad.Lift a catchE operation to the new monad.$      !"#$%&'()*+,-./01          "      !"#$%&'()*+,-./01a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe     a(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe+, A writer monad parameterized by:w - the output to accumulate.m - The inner monad.The / function produces the output , while >>=4 combines the outputs of the subcomputations using .)A writer monad parameterized by the type w of output to accumulate.The / function produces the output , while >>=4 combines the outputs of the subcomputations using .NConstruct a writer computation from a (result, output) pair. (The inverse of .)IUnwrap a writer computation as a (result, output) pair. (The inverse of .)-Extract the output from a writer computation.  m = T ( m)PMap both the return value and output of a computation using the given function.  ( f m) = f ( m)-Extract the output from a writer computation.  m = 7 T ( m)PMap both the return value and output of a computation using the given function.  ( f m) = f ( m) w' is an action that produces the output w. m' is an action that executes the action m6 and adds its output to the value of the computation.  ( m) = 7 (\ (a, w) -> ((a, w), w)) ( m) f m' is an action that executes the action m" and adds the result of applying f/ to the output to the value of the computation.  f m = 7 (id *** f) ( m)  ( f m) = 7 (\ (a, w) -> ((a, f w), w)) ( m) m' is an action that executes the action me, which returns a value and a function, and returns the value, applying the function to the output.  ( m) = 7 (\ ((a, f), w) -> (a, f w)) ( m) f m' is an action that executes the action m and applies the function f4 to its output, leaving the return value unchanged.  f m =  (7 (\ x -> (x,f)) m)  ( f m) = 7 (\ (a, w) -> (a, f w)) ( m)Lift a callCC operation to the new monad.Lift a catchE operation to the new monad.$23456789:;<=>?@ABCD"23456789:;<=>?@ABCD(c) Ross Paterson 2010 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportable Trustworthy'(*+,04=>KL Right-to-left composition of functors. The composition of applicative functors is always applicative, but the composition of monads is not always a monad.EFG !"HIJKLMNOPQRSTUVWX !" !"EFG !"HIJKLMNOPQRSTUVWX ! (c) Ross Paterson 2010 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportable Trustworthy'(*+,04=>KL#Lifted product of functors.YZ#$[\]^_`abcdefghijklmn#$#$YZ#$[\]^_`abcdefghijklmn(c) Ross Paterson 2014 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportable Trustworthy'(*+,04=>KL%Lifted sum of functors.opq%&'rstuvwxyz{|}~%&'%&'opq%&'rstuvwxyz{|}~(c) Russell O'Connor 2009 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe'+,>(The same functor, but with an 6 instance that performs actions in the reverse order.Derived instance.Derived instance.&Try alternatives in the same order as f.Apply f-actions in the reverse order.Derived instance.()*()*()*()*(c) Russell O'Connor 2009 BSD-style (see the file LICENSE)R.Paterson@city.ac.uk experimentalportableSafe'+,>+The same functor, but with  and ; instances that process the elements in the reverse order.Traverse from right to left.Fold from right to left.Derived instance.Derived instance.Derived instance.+,-+,-+,-+,- !"#$$%&'()*+,-./01234567899:;<=>?@ABCDEFGGHIJKLMNOPQRS<BCDTUVWXYZ[\]^E_FGGHIJKLMNOPQRS<BCDTUVWXYZ[\]^E_F``abZcdefghijk[\]l^E_Fmn ` ` a b Z c d e f g h i j k [ \ ] l ^ E _ F m n o p q r s t u v w x y z { | } ~              E m nEmnEFEFEFmnTUVWXYEFTUVWXYEF                          ! " # $ % & ' ( ) * + , - . / 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 bcdefghijklmnopqrstuvwxyz{|}~      !"#$%&'trans_CJvCNjEGthI2jxlViDlAnNControl.Monad.IO.ClassControl.Monad.Trans.ClassControl.Monad.Trans.ContControl.Monad.SignaturesControl.Monad.Trans.ReaderControl.Monad.Trans.RWS.LazyControl.Monad.Trans.RWS.StrictControl.Monad.Trans.State.Lazy Control.Monad.Trans.State.StrictData.Functor.ClassesData.Functor.ConstantControl.Applicative.LiftControl.Monad.Trans.ExceptControl.Monad.Trans.ErrorControl.Monad.Trans.IdentityControl.Monad.Trans.ListControl.Monad.Trans.MaybeControl.Monad.Trans.Writer.Lazy!Control.Monad.Trans.Writer.StrictData.Functor.ComposeData.Functor.ProductData.Functor.SumControl.Applicative.BackwardsData.Functor.ReversethrowEcatchEExceptTControl.Monad.Trans.RWSControl.Monad.Trans.StateErrorsControl.Monad.Trans.WriterMonadIOliftIO MonadTransliftContTrunContTContcontrunContevalContmapContwithContresetshift evalContTmapContT withContTcallCCresetTshiftT liftLocalPassListenCatchCallCCReaderT runReaderTReaderreader runReader mapReader withReader mapReaderT withReaderTasklocalasks liftCallCC liftCatchRWSTrunRWSTRWSrwsrunRWSevalRWSexecRWSmapRWSwithRWSevalRWSTexecRWSTmapRWSTwithRWSTwritertelllistenlistenspasscensorstategetputmodifygets liftCallCC'StateT runStateTStaterunState evalState execStatemapState withState evalStateT execStateT mapStateT withStateTmodify' liftListenliftPassShow2liftShowsPrec2 liftShowList2Read2liftReadsPrec2 liftReadList2Ord2 liftCompare2Eq2liftEq2Show1 liftShowsPrec liftShowListRead1 liftReadsPrec liftReadListOrd1 liftCompareEq1liftEqeq1compare1 readsPrec1 showsPrec1eq2compare2 readsPrec2 showsPrec2 readsDatareadsUnaryWithreadsBinaryWithshowsUnaryWithshowsBinaryWith readsUnary readsUnary1 readsBinary1 showsUnary showsUnary1 showsBinary1Constant getConstantLiftPureOtherunLiftmapLift runErrorsfailureExceptexcept runExcept mapExcept withExcept runExceptT mapExceptT withExceptTErrorT runErrorT ErrorListlistMsgErrornoMsgstrMsg mapErrorT throwError catchError IdentityT runIdentityT mapIdentityTListTrunListTmapListTMaybeT runMaybeT mapMaybeTmaybeToExceptTexceptToMaybeTWriterT runWriterTWriter runWriter execWriter mapWriter execWriterT mapWriterTCompose getComposeProductPairSumInLInR BackwardsforwardsReverse getReverseghc-prim GHC.TypesIObaseGHC.Basereturn $fMonadIOIOid$fMonadIOContT$fMonadTransContT $fMonadContT$fApplicativeContT$fFunctorContTliftM liftReaderT$fMonadZipReaderT$fMonadIOReaderT$fMonadTransReaderT$fMonadFixReaderT$fMonadPlusReaderT$fMonadReaderT$fAlternativeReaderT$fApplicativeReaderT$fFunctorReaderT Data.Tupleuncurry $fMonadIORWST$fMonadTransRWST$fMonadFixRWST$fMonadPlusRWST $fMonadRWST$fAlternativeRWST$fApplicativeRWST $fFunctorRWSTfstsnd$!$fMonadIOStateT$fMonadTransStateT$fMonadFixStateT$fMonadPlusStateT $fMonadStateT$fAlternativeStateT$fApplicativeStateT$fFunctorStateTGHC.ShowShow showsPrecshowListGHC.ReadRead readsPrecreadList GHC.ClassesOrdcompareEq== readListWith $fShow1Const $fRead1Const $fOrd1Const $fEq1Const $fShow2Const $fRead2Const $fOrd2Const $fEq2Const$fShow1Identity$fRead1Identity$fOrd1Identity $fEq1Identity $fShow1Either $fRead1Either $fOrd1Either $fEq1Either $fShow2Either $fRead2Either $fOrd2Either $fEq2Either $fShow1(,) $fRead1(,) $fOrd1(,)$fEq1(,) $fShow2(,) $fRead2(,) $fOrd2(,)$fEq2(,) $fShow1[] $fRead1[]$fOrd1[]$fEq1[] $fShow1Maybe $fRead1Maybe $fOrd1Maybe $fEq1Maybe$fBifunctorConstant$fMonoidConstant$fApplicativeConstant$fTraversableConstant$fFoldableConstant$fFunctorConstant$fShow1Constant$fRead1Constant$fOrd1Constant $fEq1Constant$fShow2Constant$fRead2Constant$fOrd2Constant $fEq2Constant$fShowConstant$fReadConstantpure<*> Data.EitherRightLeft$fAlternativeLift$fApplicativeLift$fTraversableLift$fFoldableLift $fFunctorLift $fShowLift $fReadLift $fOrdLift$fEqLift $fShow1Lift $fRead1Lift $fOrd1Lift $fEq1Lift$fMonadZipExceptT$fMonadIOExceptT$fMonadTransExceptT$fMonadFixExceptT$fMonadPlusExceptT$fMonadExceptT$fAlternativeExceptT$fApplicativeExceptT$fTraversableExceptT$fFoldableExceptT$fFunctorExceptT $fShowExceptT $fReadExceptT $fOrdExceptT $fEqExceptT$fShow1ExceptT$fRead1ExceptT $fOrd1ExceptT $fEq1ExceptTString $fError[]$fMonadIOErrorT$fMonadTransErrorT$fMonadFixErrorT$fMonadPlusErrorT $fMonadErrorT$fAlternativeErrorT$fApplicativeErrorT$fTraversableErrorT$fFoldableErrorT$fFunctorErrorT $fShowErrorT $fReadErrorT $fOrdErrorT $fEqErrorT $fShow1ErrorT $fRead1ErrorT $fOrd1ErrorT $fEq1ErrorT$fErrorListChar$fErrorIOException$fMonadPlusEither$fAlternativeEither$fAlternativeIO $fMonadPlusIOlift2IdentityT$fMonadTransIdentityT$fMonadZipIdentityT$fMonadIOIdentityT$fMonadFixIdentityT$fMonadPlusIdentityT$fMonadIdentityT$fAlternativeIdentityT$fApplicativeIdentityT$fTraversableIdentityT$fFoldableIdentityT$fFunctorIdentityT$fShowIdentityT$fReadIdentityT$fOrdIdentityT $fEqIdentityT$fShow1IdentityT$fRead1IdentityT$fOrd1IdentityT$fEq1IdentityT$fMonadZipListT$fMonadIOListT$fMonadTransListT$fMonadPlusListT $fMonadListT$fAlternativeListT$fApplicativeListT$fTraversableListT$fFoldableListT$fFunctorListT $fShowListT $fReadListT $fOrdListT $fEqListT $fShow1ListT $fRead1ListT $fOrd1ListT $fEq1ListTMaybe$fMonadZipMaybeT$fMonadIOMaybeT$fMonadTransMaybeT$fMonadFixMaybeT$fMonadPlusMaybeT $fMonadMaybeT$fAlternativeMaybeT$fApplicativeMaybeT$fTraversableMaybeT$fFoldableMaybeT$fFunctorMaybeT $fShowMaybeT $fReadMaybeT $fOrdMaybeT $fEqMaybeT $fShow1MaybeT $fRead1MaybeT $fOrd1MaybeT $fEq1MaybeTmemptymappend$fMonadZipWriterT$fMonadIOWriterT$fMonadTransWriterT$fMonadFixWriterT$fMonadPlusWriterT$fMonadWriterT$fAlternativeWriterT$fApplicativeWriterT$fTraversableWriterT$fFoldableWriterT$fFunctorWriterT $fShowWriterT $fReadWriterT $fOrdWriterT $fEqWriterT$fShow1WriterT$fRead1WriterT $fOrd1WriterT $fEq1WriterT MSCompose MCCompose MDCompose$fAlternativeCompose$fApplicativeCompose$fTraversableCompose$fFoldableCompose$fFunctorCompose $fShowCompose $fReadCompose $fOrdCompose $fEqCompose$fShow1Compose$fRead1Compose $fOrd1Compose $fEq1Compose$fSelectorMSCompose$fConstructorMCCompose$fDatatypeMDCompose$fGeneric1ComposeMCPair MDProduct$fMonadZipProduct$fMonadFixProduct$fMonadPlusProduct$fMonadProduct$fAlternativeProduct$fApplicativeProduct$fTraversableProduct$fFoldableProduct$fFunctorProduct $fShowProduct $fReadProduct $fOrdProduct $fEqProduct$fShow1Product$fRead1Product $fOrd1Product $fEq1Product$fConstructorMCPair$fDatatypeMDProduct$fGeneric1ProductMCInRMCInLMDSum$fTraversableSum $fFoldableSum $fFunctorSum $fShowSum $fReadSum$fOrdSum$fEqSum $fShow1Sum $fRead1Sum $fOrd1Sum$fEq1Sum$fConstructorMCInR$fConstructorMCInL$fDatatypeMDSum $fGeneric1Sum Applicative$fTraversableBackwards$fFoldableBackwards$fAlternativeBackwards$fApplicativeBackwards$fFunctorBackwards$fShowBackwards$fReadBackwards$fOrdBackwards $fEqBackwards$fShow1Backwards$fRead1Backwards$fOrd1Backwards$fEq1Backwards Data.FoldableFoldableData.Traversable Traversable$fTraversableReverse$fFoldableReverse$fAlternativeReverse$fApplicativeReverse$fFunctorReverse $fShowReverse $fReadReverse $fOrdReverse $fEqReverse$fShow1Reverse$fRead1Reverse $fOrd1Reverse $fEq1Reverse