h&eY^f      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX 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 { | } ~                                          %(C) Koz Ross 2022, Manuel Brenz 2021#BSD-3-Clause (see the LICENSE file)koz.ross@retro-freedom.nz ExperimentalGHC only Trustworthy 5?izmtlA helper type to decrease boilerplate when defining new transformer instances of |.Most of the instances in this module are derived using this method; for example, our instance of f is derived as follows: deriving via (LiftingAccum (ExceptT e) m) instance (MonadAccum w m) => MonadAccum w (ExceptT e m)|mtlThe capability to accumulate. This can be seen in one of two ways:A  which can only append (using ); orA  (limited to 7) with the ability to view the result of all previous s.Laws should obey the following:  ( (x, )) =  x f   g =   acc -> let (_, v) = f acc (res, w) = g (acc  v) in (res, v  w)If you choose to define } and ~5 instead, their definitions must obey the following: }  } = }~  =  ()~ x  ~ y = ~ (x  y)~ x  } = }  w -> ~ x  w  xIf you want to define both, the relationship between them is as follows. These are also the default definitions. } =   acc -> (acc, mempty)~ x =   acc -> ((), x) f = }$ >>= acc -> let (res, v) = f acc in ~ v  res}mtl'Retrieve the accumulated result so far.~mtlAppend a value to the result.mtl2Embed a simple accumulation action into the monad.mtl-Retrieve a function of the accumulated value.mtlmtlmtlmtlmtlmtlmtlmtlmtlmtlmtl7The 'ranking' function gains the ability to accumulate ws each time it is called. The final result will include the entire log of all such calls.mtlmtlmtlmtlmtlmtlThe accumulated value 'survives' an exception: even if the computation fails to deliver a result, we still have an accumulated value.mtlThe continuation can see, and interact with, the accumulated value.mtlThe accumulated value 'survives' an error: even if the computation fails to deliver a result, we still have an accumulated value.z{|}~|}~z{ (c) The University of Glasgow 2001, (c) Jeff Newbern 2003-2007, (c) Andriy Palamarchuk 2007 BSD-style (see the file LICENSE)libraries@haskell.org experimentalportableSafe0 mtlcallCC (call-with-current-continuation) calls a function with the current continuation as its argument. Provides an escape continuation mechanism for use with Continuation monads. Escape continuations allow to abort the current computation and return a value immediately. They achieve a similar effect to  and  within an  4 monad. Advantage of this function over calling return is that it makes the continuation explicit, allowing more flexibility and better control (see examples in Control.Monad.Cont).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.mtlIntroduces a recursive binding to the continuation. Due to the use of callCC, calling the continuation will interrupt execution of the current block creating an effect similar to goto/setjmp in C.mtlSimplified version of  without arguments.mtlLift a -style function through any . NoteFor any function f, 'liftCallCC f' satisfies the  https://hackage.haskell.org/package/transformers-0.5.6.2/docs/Control-Monad-Signatures.html#t:CallCCuniformity condition provided that f0 is quasi-algebraic. More specifically, for any g, we must have: ;'join' '$' f (\exit -> 'pure' '$' g (exit '.' 'pure') = f g: is quasi-algebraic; furthermore, for any quasi-algebraic f,  f is also quasi-algebraic. See also https://gist.github.com/KingoftheHomeless/5927257cc7f6f8a2da685a2045dac204$Proof of quasi-algebraic properties (https://github.com/haskell/mtl/issues/77Original issuemtlmtlmtlmtlmtl (c) The University of Glasgow 2001, (c) Jeff Newbern 2003-2007, (c) Andriy Palamarchuk 2007 BSD-style (see the file LICENSE)libraries@haskell.org experimentalportableSafeponqrstuvwxyqytxvsponwur(c) Michael Weber 2001, (c) Jeff Newbern 2003-2006, (c) Andriy Palamarchuk 2006 (c) Edward Kmett 2012 BSD-style (see the file LICENSE)libraries@haskell.org experimental+non-portable (multi-parameter type classes)Safe(mtlThe strategy of combining computations that can throw exceptions by bypassing bound functions from the point an exception is thrown to the point that it is handled.Is parameterized over the type of error information and the monad type constructor. It is common to use  String as the monad type constructor for an error monad in which error descriptions take the form of strings. In 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. In these cases you will have to explicitly define instances of the ) class. (If you are using the deprecated Control.Monad.Error or Control.Monad.Trans.Error!, you may also have to define an Error instance.)mtlIs used within a monadic computation to begin exception processing.mtlA handler function to handle previous errors and return to normal execution. A common idiom is: 5do { action1; action2; action3 } `catchError` handler where the action functions can call . Note that handler1 and the do-block must have the same return type.mtl Lifts an  e into any  e. -do { val <- liftEither =<< action1; action2 }where action1 returns an  to represent errors.mtl analogue to the  function.mtl analogue to the  withExceptT function. Modify the value (but not the type) of an error. The type is fixed because of the functional dependency m -> e&. If you need to change the type of e use  or .mtlAs handle is flipped ,  is flipped .mtl analogue of the  mapExceptT function. The computation is unwrapped, a function is applied to the Either,, and the result is lifted into the second  instance.mtl A different  analogue to the  withExceptT function. Modify the value (and possibly the type) of an error in an ExceptT(-transformed monad, while stripping the ExceptT layer. This is useful for adapting the  constraint of a computation. For example: data DatabaseError = ... performDatabaseQuery :: (MonadError DatabaseError m, ...) => m PersistedValue data AppError = MkDatabaseError DatabaseError | ... app :: (MonadError AppError m, ...) => m ()Given these types, performDatabaseQuery cannot be used directly inside app-, because the error types don't match. Using , an equivalent function with a different error type can be constructed: performDatabaseQuery' :: (MonadError AppError m, ...) => m PersistedValue performDatabaseQuery' = modifyError MkDatabaseError performDatabaseQuery Since the error types do match, performDatabaseQuery' _can_ be used in app,, assuming all other constraints carry over. This works by instantiating the m in the type of performDatabaseQuery to ExceptT DatabaseError m', which satisfies the MonadError DatabaseError constraint. Immediately, the ExceptT DatabaseError layer is unwrapped, producing  a  DatabaseError or a PersistedValue.. If it's the former, the error is wrapped in MkDatabaseError and re-thrown in the inner monad, otherwise the result value is returned.mtlmtlmtlmtlmtl   (c) Michael Weber 2001, (c) Jeff Newbern 2003-2006, (c) Andriy Palamarchuk 2006 BSD-style (see the file LICENSE)libraries@haskell.org experimental+non-portable (multi-parameter type classes)Safe)feghijklmfegjlhkmi(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology 2001, (c) Jeff Newbern 2003-2006, (c) Andriy Palamarchuk 2006 BSD-style (see the file LICENSE)libraries@haskell.org experimentalportableSafe+, (c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology 2001, (c) Jeff Newbern 2003-2007, (c) Andriy Palamarchuk 2007 BSD-style (see the file LICENSE)libraries@haskell.org experimental;non-portable (multi-param classes, functional dependencies)Safe/W mtlSee examples in Control.Monad.Reader-. Note, the partially applied function type (->) r$ is a simple reader monad. See the instance declaration below.mtl Retrieves the monad environment.mtl1Executes a computation in a modified environment.mtl0Retrieves a function of the current environment.mtl0Retrieves a function of the current environment.mtlmtlmtlmtlmtlmtl'The function to modify the environment.mtlReader$ to run in the modified environment.mtl2The selector function to apply to the environment.mtl2The selector function to apply to the environment.(C) Koz Ross 2022#BSD-3-Clause (see the LICENSE file)koz.ross@retro-freedom.nz ExperimentalGHC only Trustworthy 5?BmtlA helper type to decrease boilerplate when defining new transformer instances of .Most of the instances in this module are derived using this method; for example, our instance of f is derived as follows: deriving via (LiftingSelect (ExceptT e) m) instance (MonadSelect r m) => MonadSelect r (ExceptT e m)mtlThe capability to search with backtracking. Essentially describes a 'policy function': given the state of the search (and a 'ranking' or 'evaluation' of each possible result so far), pick the result that's currently best.LawsAny instance of  must follow these laws: ( x) =  x f   g =  gmtlmtlmtlmtlmtlmtl'Readerizes' the accumulator: the 'ranking' function can see the value that has been accumulated (of type w), but can't add anything to it. Effectively, can be thought of as 'extending' the 'ranking' by all values of w, but which w gets given to any rank calls is predetermined by the 'outer accumulation' (and cannot change).mtlA combination of an 'outer' 5, WriterT and StateT%. In short, you get a value of type r which can influence what gets picked, but not how anything is ranked, and the 'ranking' function gets access to an s and a w, but can modify neither.mtlA combination of an 'outer' 5, WriterT and StateT%. In short, you get a value of type r which can influence what gets picked, but not how anything is ranked, and the 'ranking' function gets access to an s and a w, but can modify neither.mtlA combination of an 'outer' 5, WriterT and StateT%. In short, you get a value of type r which can influence what gets picked, but not how anything is ranked, and the 'ranking' function gets access to an s and a w, but can modify neither.mtl'Readerizes' the writer: the 'ranking' function can see the value that's been accumulated (of type w), but can't add anything to the log. Effectively, can be thought of as 'extending' the 'ranking' by all values of w, but which w gets given to any rank calls is predetermined by the 'outer writer' (and cannot change).mtl'Readerizes' the writer: the 'ranking' function can see the value that's been accumulated (of type w), but can't add anything to the log. Effectively, can be thought of as 'extending' the 'ranking' by all values of w, but which w gets given to any rank calls is predetermined by the 'outer writer' (and cannot change).mtl'Readerizes' the writer: the 'ranking' function can see the value that's been accumulated (of type w), but can't add anything to the log. Effectively, can be thought of as 'extending' the 'ranking' by all values of w, but which w gets given to any rank calls is predetermined by the 'outer writer' (and cannot change).mtl3'Readerizes' the state: the 'ranking' function can see a value of type s, but not modify it. Effectively, can be thought of as 'extending' the 'ranking' by all values in s, but which s gets given to any rank calls is predetermined by the 'outer state' (and cannot change).mtl3'Readerizes' the state: the 'ranking' function can see a value of type s, but not modify it. Effectively, can be thought of as 'extending' the 'ranking' by all values in s, but which s gets given to any rank calls is predetermined by the 'outer state' (and cannot change).mtl)Provides a read-only environment of type r to the 'strategy' function. However, the 'ranking' function (or more accurately, representation) has no access to r. Put another way, you can influence what values get chosen by changing r#, but not how solutions are ranked.mtlmtl*'Extends' the possibilities considered by m to include every value of e9; this means that the potential result could be either a  (making it a choice of type e) or a  (making it a choice of type a).mtlThe continuation describes a way of choosing a 'search' or 'ranking' strategy for r, based on a 'ranking' using r' , given any a'. We then get a 'search' strategy for r.mtl*'Extends' the possibilities considered by m to include ; this means that $ gains a 'rank' (namely, a value of r+), and the potential result could also be .(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)libraries@haskell.org experimental;non-portable (multi-param classes, functional dependencies)SafeGG mtl%Minimal definition is either both of get and put or just statemtl1Return the state from the internals of the monad.mtl#Replace the state inside the monad.mtl+Embed a simple state action into the monad.mtlMonadic state transformer.Maps an old state to a new state inside a state monad. The old state is thrown away.  Main> :t modify ((+1) :: Int -> Int) modify (...) :: (MonadState Int a) => a ()This says that  modify (+1)1 acts over any Monad that is a member of the  MonadState class, with an Int state.mtl A variant of 6 in which the computation is strict in the new state.mtlGets specific component of the state, using a projection function supplied.mtlmtlmtlmtlmtl(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)libraries@haskell.org experimentalportableSafeH0(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)libraries@haskell.org experimental;non-portable (multi-param classes, functional dependencies)SafeI8 !"#$%%#!$" (c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)libraries@haskell.org experimental;non-portable (multi-param classes, functional dependencies)SafeJv('&)*+,-./012),20.+('&1/-*(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)libraries@haskell.org experimental;non-portable (multi-param classes, functional dependencies)SafeK('&)*+,-./012(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology 2001, (c) Jeff Newbern 2003-2007, (c) Andriy Palamarchuk 2007 BSD-style (see the file LICENSE)libraries@haskell.org experimental;non-portable (multi-param classes, functional dependencies)SafeM,5436789:;69;8543:7(c) Andy Gill 2001, (c) Oregon Graduate Institute of Science and Technology, 2001 BSD-style (see the file LICENSE)libraries@haskell.org experimental;non-portable (multi-param classes, functional dependencies)SafeS mtl (a,w) embeds a simple writer action.mtl w' is an action that produces the output w.mtl m' is an action that executes the action m6 and adds its output to the value of the computation.mtl m' is an action that executes the action m, which returns a value and a function, and returns the value, applying the function to the output.mtl 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 = liftM (id *** f) ( m)mtl 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 =  (liftM (\x -> (x,f)) m)mtl"There are two valid instances for . It could either: !Lift the operations to the inner  MonadWriter%Handle the operations itself,  la a WriterT.==!;?!;@!;A!;B!;C!DE!DF!DF!DG!DH!DI!DJ!DK!DL!DM!DN!DO!DP!DQ!RE!RF!RF!RG!RH!RI!RJ!RK!RL!RM!RN!RO!RP!RQ!SF!SG!SH!SI!SJ!SE!SK!SL!SM!SN!SO!SP!SQ!TU!TU!T!TV!TW!TX!TY!TZ!T[!\]!\^!\^!\_!\`!\a!\b!\c!\d!\e!\f!\g h h i j k l m n o p q r s t u v w x y z { | } ~                     !\!!!!!!!!! mtl-2.3.1-IJJ4fATi5qaBmc1JfTHHL9Control.Monad.Writer.StrictControl.Monad.Writer.LazyControl.Monad.Writer.CPSControl.Monad.State.StrictControl.Monad.State.LazyControl.Monad.ReaderControl.Monad.RWS.StrictControl.Monad.RWS.LazyControl.Monad.RWS.CPSControl.Monad.ExceptControl.Monad.ContControl.Monad.AccumControl.Monad.Cont.ClassControl.Monad.Error.ClassControl.Monad.Reader.ClassControl.Monad.SelectControl.Monad.State.ClassControl.Monad.Writer.ClassControl.Monad.RWS.Class MonadState MonadWritertell throwError catchErrorExceptControl.ExceptiontryControl.Monad.IdentityControl.Monad.TransControl.Monad.StateControl.Monad.RWSControl.Monad.Writertransformers-0.5.6.2!Control.Monad.Trans.Writer.Strict runWriterTWriterTWriter runWriter mapWriterT mapWriter execWriterT execWriterControl.Monad.Trans.Writer.LazyControl.Monad.Trans.Writer.CPS Control.Monad.Trans.State.Strict runStateTStateTState withStateT withStaterunState mapStateTmapState execStateT execState evalStateT evalStateControl.Monad.Trans.State.LazyControl.Monad.Trans.Reader runReaderTReaderTReader withReaderT withReader runReader mapReaderT mapReaderControl.Monad.Trans.RWS.StrictrunRWSTRWSTRWSwithRWSTwithRWSrwsrunRWSmapRWSTmapRWSexecRWSTexecRWSevalRWSTevalRWSControl.Monad.Trans.RWS.LazyControl.Monad.Trans.RWS.CPSControl.Monad.Trans.ExceptExceptT withExceptT withExcept runExceptT runExcept mapExceptT mapExceptControl.Monad.Trans.ContrunContTContTCont withContTwithContrunContmapContTmapCont evalContTevalContcont LiftingAccum MonadAccumlookaddaccumlooks$fMonadAccumwAccumT$fMonadAccumwLiftingAccum$fFunctorLiftingAccum$fApplicativeLiftingAccum$fMonadLiftingAccum$fMonadAccumw'WriterT$fMonadAccumw'WriterT0$fMonadAccumw'WriterT1$fMonadAccumwStateT$fMonadAccumwStateT0$fMonadAccumwSelectT$fMonadAccumwReaderT$fMonadAccumw'RWST$fMonadAccumw'RWST0$fMonadAccumw'RWST1$fMonadAccumwIdentityT$fMonadAccumwExceptT$fMonadAccumwContT$fMonadAccumwMaybeT MonadContcallCClabellabel_ liftCallCC$fMonadContAccumT$fMonadContWriterT$fMonadContRWST$fMonadContWriterT0$fMonadContWriterT1$fMonadContStateT$fMonadContStateT0$fMonadContRWST0$fMonadContRWST1$fMonadContReaderT$fMonadContMaybeT$fMonadContIdentityT$fMonadContExceptT$fMonadContContT MonadError liftEithertryError withError handleErrormapError modifyError$fMonadErroreAccumT$fMonadErroreWriterT$fMonadErroreRWST$fMonadErroreWriterT0$fMonadErroreWriterT1$fMonadErroreStateT$fMonadErroreStateT0$fMonadErroreRWST0$fMonadErroreRWST1$fMonadErroreReaderT$fMonadErroreMaybeT$fMonadErroreIdentityT$fMonadErroreExceptT$fMonadErroreEither$fMonadError()Maybe$fMonadErrorIOExceptionIO MonadReaderasklocalreaderasks$fMonadReaderr'SelectT$fMonadReaderrAccumT$fMonadReaderrWriterT$fMonadReaderrWriterT0$fMonadReaderrWriterT1$fMonadReaderrStateT$fMonadReaderrStateT0$fMonadReaderrMaybeT$fMonadReaderrIdentityT$fMonadReaderrExceptT$fMonadReaderr'ContT$fMonadReaderrRWST$fMonadReaderrRWST0$fMonadReaderrRWST1$fMonadReaderrReaderT$fMonadReaderrFUN LiftingSelect MonadSelectselect$fMonadSelectrSelectT$fMonadSelectrLiftingSelect$fFunctorLiftingSelect$fApplicativeLiftingSelect$fMonadLiftingSelect$fMonadSelectrAccumT$fMonadSelectw'RWST$fMonadSelectw'RWST0$fMonadSelectw'RWST1$fMonadSelectw'WriterT$fMonadSelectw'WriterT0$fMonadSelectw'WriterT1$fMonadSelectwStateT$fMonadSelectwStateT0$fMonadSelectr'ReaderT$fMonadSelectrIdentityT$fMonadSelectrExceptT$fMonadSelectr'ContT$fMonadSelectrMaybeTgetputstatemodifymodify'gets$fMonadStatesSelectT$fMonadStatesAccumT$fMonadStatesWriterT$fMonadStatesWriterT0$fMonadStatesWriterT1$fMonadStatesReaderT$fMonadStatesMaybeT$fMonadStatesIdentityT$fMonadStatesExceptT$fMonadStatesContT$fMonadStatesRWST$fMonadStatesRWST0$fMonadStatesRWST1$fMonadStatesStateT$fMonadStatesStateT0writerlistenpasslistenscensor$fMonadWriterwAccumT$fMonadWriterwStateT$fMonadWriterwStateT0$fMonadWriterwReaderT$fMonadWriterwMaybeT$fMonadWriterwIdentityT$fMonadWriterwExceptT$fMonadWriterwRWST$fMonadWriterwRWST0$fMonadWriterwRWST1$fMonadWriterwWriterT$fMonadWriterwWriterT0$fMonadWriterwWriterT1$fMonadWriterw(,)MonadRWS$fMonadRWSrwsMaybeT$fMonadRWSrwsIdentityT$fMonadRWSrwsExceptT$fMonadRWSrwsRWST$fMonadRWSrwsRWST0$fMonadRWSrwsRWST1baseGHC.Base<>constmemptypure*>$>>= Data.Functor$>Control.Monad.Trans.Class MonadTrans Data.EitherEitherGHC.IOcatchData.Functor.IdentityIdentity runIdentityControl.Monad.Trans.Identity IdentityT runIdentityT mapIdentityT liftCatchLeftRight GHC.MaybeNothingControl.Monad.IO.ClassMonadIOliftIOliftControl.Monad.Trans.AccumAccumT