úΙé’Ån      !"#$%&'()*+,-./0123456789: ; < = > ? @ 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[\]^_`abcdefghijklm Trustworthy:=JKM&A sum data type, for composing effects Parameter r> is phantom: it just tells what could be in the union. Where r is t1 :> t2 ... :> tn,  r v* can be constructed with a value of type ti v4. Ideally, we should be able to add the constraint Member t r.RNOTE: exposing the constructor below allows users to bypass the type system. See  for example.nn Trustworthy '(2468=JKo3This class is used for emulating monad transformersp¢Class Member is defined only for the sake of the interface compatibility with OpenUnion1. Generally, the closed type family Member' below could be used instead.The p t r specifies whether t& is present anywhere in the sum type r, where t is some effectful type, e.g. Lift q, State Int`. rostpuvwxop rostpuvwx Trustworthy '2468=JK3This class is used for emulating monad transformersThe  t r specifies whether t& is present anywhere in the sum type r, where t is some effectful type, e.g. Lift q, State Int`.yz{|yz{| Trustworthy '+2468=JK is similar to V, but it allows types to belong to a "set". For every set, only one member can be in rb at any given time. This allows us to specify exclusivity and uniqueness among arbitrary effects: ÿw-- Terminal effects (effects which must be run last) data Terminal -- Make Lifts part of the Terminal effects set. -- The fundep assures that there can only be one Terminal effect for any r. instance Member (Lift m) r => SetMember Terminal (Lift m) r -- Only allow a single unique Lift effect, by making a "Lift" set. instance Member (Lift m) r => SetMember Lift (Lift m) r}for the sake of gcast1 used below in ~infix form of  fromMaybe.Construct a Union.7Try extracting the contents of a Union as a given type.jExtract the contents of a Union as a given type. If the Union isn't of that type, a runtime error occurs. „Try extracting the contents of a Union as a given type. If we can't, return a reduced Union that excludes the type we just checked. )Juggle types for a Union. Use cautiously. }€~    }€~ ~ Trustworthy+-2346:BEHJKM OBasic datatype returned by all computations with extensible effects. The type r2 is the type of effects that can be handled, and a' is the type of value that is returned.A ) is either a value, or an effect of type  r producing another . The result is that a * can produce an arbitrarily long chain of  r( effects, terminated with a pure value.VGiven a method of turning requests into results, we produce an effectful computation.]Tell an effectful computation that you're ready to start running effects and return a value.'Get the result from a pure computation..Given a request, either handle it or relay it.…Given a request, either handle it or relay it. Both the handler and the relay can produce the same type of request that was handled. ‚RequestRelay the requestHandle the request of type tƒ„…     ‚ƒ„… Trustworthy+3:JKMNondeterministic choicefchoose lst non-deterministically chooses one value from the lst choose [] thus corresponds to failure3MonadPlus-like operators are expressible via choose3MonadPlus-like operators are expressible via choose4Run a nondeterministic effect, returning all values.†† Trustworthy+-3JK€Status of a thread: done or reporting the value of the type a (For simplicity, a co-routine reports a value but accepts unit)Type parameter r# is the effect we're yielding from.Type parameter a is the type that is yielded.Type parameter wO is the type of the value returned from the coroutine when it has completed. The yield request: reporting a value of type e and suspending the coroutine. For readability, a coroutine accepts a unit to produce its value."2Yield a value of type a and suspend the coroutine.#&Launch a thread and report its status. !"# !"# !"# !"# Trustworthy +2346:JKM$Lift a Monad m to an effect.&Lift a Monad to an Effect.'_The handler of Lift requests. It is meant to be terminal: we only allow a single Lifted Monad.$%&'‡ˆ‰$%&'$%&'$%&'‡ˆ‰ Trustworthy+-3JK )DThese are exceptions of the type e. This is akin to the error monad.+/Throw an exception in an effectful computation.,?Makes an effect fail, preventing future effects from happening.-2Run a computation that might produce an exception..<Runs a failable effect, such that failed computation return Š , and ‹ the return value on success./mRun a computation that might produce exceptions, and give it a way to deal with the exceptions that come up.0sAdd a default value (i.e. failure handler) to a fallible computation. This hides the fact that a failure happened.1iRun a computation until it produces an exception, and convert and throw that exception in a new context.26Treat Lefts as exceptions and Rights as return values.32 in a lifted Monad4Lift a maybe into the (! effect, causing failure if it's Š.5Ignores a failure event. Since the event can fail, you cannot inspect its return type, because it has none on failure. To inspect it, use ..()*+,-./0The fallible computation."The computation to run on failure.12345()*+,-./012345)*(+,-./012345 ()*+,-./012345 Trustworthy+3JK9ÿèThe interpreter -- it is like reify . reflect with a twist Compare this implementation with the huge implementation of call in Hinze 2000 (Figure 9) Each clause corresponds to the axiom of call or cutfalse. All axioms are covered. The code clearly expresses the intuition that call watches the choice points of its argument computation. When it encounteres a cutfalse request, it discards the remaining choicepoints. It completely handles CutFalse effects but not non-determinism.6789678967986789  Trustworthy+36BJK: Create unique Enumerable values.<6Produce a value that has not been previously produced.=&Run an effect requiring unique values.:;<=:;<=:;<=:;<=  Trustworthy+-36JK>xThe request for a value of type e from the current environment. This environment is analogous to a parameter of type e.@$Get the current value from a Reader.AmLocally rebind the value in the dynamic environment. This function both requests and admins Reader requests.B>Request the environment value using a transformation function.CbThe handler of Reader requests. The return type shows that all Reader requests are fully handled.>?@ABC>?@ABC>?@ABC>?@ABC  Trustworthy+-36JKDxThe request for a value of type e from the current environment. This environment is analogous to a parameter of type e.F$Get the current value from a Reader.GmLocally rebind the value in the dynamic environment. This function both requests and admins Reader requests.H>Request the environment value using a transformation function.IbThe handler of Reader requests. The return type shows that all Reader requests are fully handled.DEFGHIDEFGHIDEFGHIDEFGHI  Trustworthy+-36JKJStrict state effectLWrite a new value of the state.M&Return the current value of the state.N$Transform the state with a function.ORun a State effect.P/Run a State effect, discarding the final state.Q.Run a State effect and return the final state.JKLMNO Initial stateEffect incorporating State0Effect containing final state and a return valuePQJKLMNOPQJKMLNOPQJKLMNOPQ  Trustworthy+-36JKRStrict state effectTWrite a new value of the state.U&Return the current value of the state.V$Transform the state with a function.WRun a State effect.X/Run a State effect, discarding the final state.Y.Run a State effect and return the final state.RSTUVW Initial stateEffect incorporating State0Effect containing final state and a return valueXYRSTUVWXYRSUTVWXYRSTUVWXY Trustworthy+-36JKZDThe request to remember a value of type w in the current environment\Write a new value.]#Transform the state being produced.^LHandle Writer requests, using a user-provided function to accumulate values._:Handle Writer requests by taking the first value provided.`6Handle Writer requests by overwriting previous values.aEHandle Writer requests, using a Monoid instance to accumulate values.Z[\]^_`aZ[\]^_`aZ[\]^_`aZ[\]^_`a Trustworthy+-36JKbDThe request to remember a value of type w in the current environmentdWrite a new value.e#Transform the state being produced.fLHandle Writer requests, using a user-provided function to accumulate values.g:Handle Writer requests by taking the first value provided.h6Handle Writer requests by overwriting previous values.iEHandle Writer requests, using a Monoid instance to accumulate values.bcdefghibcdefghibcdefghibcdefghi Trustworthy+-3JKjTrace effect for debugginglPrint a string as a trace.m#Run a computation producing Traces.jklmjklmjklmjklmŒ !"#$%&'(()*+,-.-//012234566789:;<=>?@ABBCD E E F G H H I J K L H H I J K L M M N O P Q R S M M N O P Q R STTUVWXYZTTUVWXYZ[[\]^_`abcdefghijklmnmopqrstuvwxyz{yz|}extensible-effects-1.8.0.0"Data.OpenUnion.Internal.OpenUnion1Data.OpenUnion Control.EffControl.Eff.ChooseControl.Eff.CoroutineControl.Eff.LiftControl.Eff.ExceptionControl.Eff.CutControl.Eff.FreshControl.Eff.Reader.LazyControl.Eff.Reader.StrictControl.Eff.State.LazyControl.Eff.State.StrictControl.Eff.Writer.LazyControl.Eff.Writer.StrictControl.Eff.TraceData.OpenUnion.Internal.Base unsafeReUnion"Data.OpenUnion.Internal.OpenUnion2:>UnionMemberUMember SetMemberinjprjprjForcedecompweakenEffrunEffVEEValsendadminrun handleRelay interposeChoosechoosemzero'mplus' runChoiceYDoneYieldyieldrunCLiftliftrunLiftFailExcthrowExcdierunExcrunFailcatchExconFail rethrowExc liftEither liftEitherM liftMaybe ignoreFailCutFalsecutfalsecallFreshfreshrunFreshReaderasklocalreader runReaderStateputgetmodifyrunState evalState execStateWritertellcensor runWriterrunFirstWriter runLastWriterrunMonoidWriterTracetracerunTrace$fFunctorUnionghc-prim GHC.TypesIOMemberU'EQUMember'$fMemberU'kFalsetagt:>$fMemberU'kTruetagtag:>$fMemberUktagt1:> $fMembertr$fMemberUk*tagt:>$fMemberUk*tagtag:> $fMember*t:> $fMember*t:>0IdrunId$fSetMember(->)ksettrfromVal $fMonadEff$fApplicativeEff $fFunctorEff$fFunctorChoose$fMonadBasebEff $fMonadIOEff $fFunctorLiftbase Data.MaybeNothingJust