Îõ³h$þ™?      !"#$%&'()*+,-./0123456789:;<=>=Efficient effect handlers based on Evidence Passing Semantics#(c) 2021, Ningning Xie, Daan LeijenMIT!xnning@hku.hk; daan@microsoft.com ExperimentalNone'(-/>?ÀÁÂÉÔÖ×ÙRmpeffŒThe type of the built-in state effect. (This state is generally more efficient than rolling your own and usually used in combination with ! to provide local isolated state)mpeff(The abstract type of operations of type a to b., for a handler defined in an effect context e and answer type ans. mpeffØMask the top effect handler in the give action (i.e. if a operation is performed on an h effect inside e the top handler is ignored). mpeffÇCreate an operation that always resumes with a constant value (of type a). (see also the   example). mpeff3Create an operation that takes an argument of type a* and always resumes with a result of type b. These are called tail-resumptiveÜ operations and are implemented more efficient than general operations as they can execute in-placeÛ (instead of yielding to the handler). Most operations are tail-resumptive. (See also the  example). mpeff,Create an fully general operation from type a to b. the function f takes the argument, and a  resumption function of type b ->  e ansÈ that can be called to resume from the original call site. For example: )data Amb e ans = Amb { flip :: forall b.  () Bool e ans } xor :: (Amb  e) =>  e Bool xor = do x <-   flip () y <-  Æ flip () return ((x && not y) || (not x && y)) solutions ::  (Amb  e) a ->  e [a] solutions = ' (\x -> [x]) $ Amb{ flip =  Ä (\() k -> do{ xs <- k True; ys <- k False; return (xs ++ ys)) }) } mpeff=Create an operation that never resumes (an exception). (See  for an example).mpeff!Get the value of the local state.mpeff!Set the value of the local state.mpeff$Update the value of the local state.mpeff:Get the value of the local state if it is the top handler.mpeff:Set the value of the local state if it is the top handler.mpeff=Update the value of the local state if it is the top handler.mpeff;Create a local state handler with an initial state of type aÞ, with a return function to combine the final result with the final state to a value of type b.mpeff;Create a local state handler with an initial state of type a.mpeffCreate a new handler for h which can access the locally isolated state  a&. This is fully local to the handler h only and not visible in the action2 as apparent from its effect context (which does not contain  a). The retÒ argument can be used to transform the final result combined with the final state.mpeffCreate a new handler for h which can access the locally isolated state  a&. This is fully local to the handler h only and not visible in the action2 as apparent from its effect context (which does not contain  a). $data State a e ans = State { get ::  () a e ans, put ::  a () e ans } state :: a ->  (State a  e) ans ->  e ans state init =  init (State{ get =   (\_ ->   3 ()), put =   (\x ->    x) }) test = = $ state (41::Int) $ inc -- see       5$Definitions for some common effects.7(c) 2021, Microsoft Research; Daan Leijen; Ningning XieMIT!xnning@hku.hk; daan@microsoft.com ExperimentalNone >?ÀÁÂÔÖ×Ù1#mpeffChoose implements backtracking.%mpeff&@`perform none ()` indicates no result&mpeff  choose n` resumes up to n times (returning 1 up to n@)'mpeff5A standard exception effect, throwing values of type a.)mpeff(Throw an exception with a value of type a (as   throwError x)*mpeff!A standard writer effect of type a,mpeffOutput a value of type a (as   tell msg)-mpeff A standard state effect of type a./mpeffGet the current state (as   get ())0mpeffSet the current state (as   put x)1mpeff,A standard reader effect for values of type a.3mpeffget the reader value of type a (as   ask ())4mpeffA handler for a 1 effect with a value of type a.5mpeff4A state handler that takes an initial state of type a.6mpeff A standard * handler for any monoidal type a$. Returns the final result of type ans and the appended tell arguments.7mpeffHandle an exception.8mpeff$Transform an exception effect to an Either type.9mpeffÒRemove the exception effect using a default value in case an exception was thrown.:mpeff#Transform an exception effect to a Maybe type.;mpeff5Return the first result found in a computation using & for backtracking.<mpeff9Return all possible results found in a computation using & for backtracking#$%&'()*+,-./0123456789:;<1234-./05*+,6'()78:9#$%&;< Safe-InferredŒ?@ABCDEFÇ      !"#$%&''()**+,,-../01123456789:;<=>?@ABCDEÆ$mpeff-0.1.0.0-94CX8Zij9Ab2gDkr9uFVjcControl.Mp.EffControl.Mp.Util Paths_mpeffLocalOp:?Eff:*handlerrunEff handlerRet handlerHidemaskperformvaluefunction operationexceptlgetlputlmodifylocalGetlocalPut localModifylocalRetlocalhandlerLocalRet handlerLocal $fShowMarker $fMonadCtl$fApplicativeCtl $fFunctorCtl $fMonadEff$fApplicativeEff $fFunctorEff$fInEqFalsehh'e$fInEqTruehh'e$fInh:*ChoosenonechooseExcept throwErrorWritertellStategetputReaderaskreaderstatewriter catchError exceptEither exceptDefault exceptMaybe chooseFirst chooseAll$fMonadPlusEff$fAlternativeEffversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName