śĪ!e‚YŌ±      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWX Y Z[\]^_`abcdef ghi j k l m n o p q rstuvw x y z { | } ~  €  ‚ ƒ „ … †‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ”¢£¤„¦§Ø©Ŗ«¬­®Æ°None&',-.14>DHSUVX_k.±polysemyUnhandled effectspolysemyvThis constraint gives helpful error messages if you attempt to use a first-order combinator with a higher-order type.Note that the parameter mZ is only required to work around supporting versions of GHC without QuantifiedConstraintsNone&'-.148>DHSUVX_k/polysemyThe class for semantic effects. An effect e is a type e m a%, where the other types are given by:The mQ type variable corresponds to a monad, which will eventually be instantiated at >---meaning it is capable of encoding arbitrary other effects.The a1 type is handled automatically and uninteresting. The type e m must be a ²:, but this instance can always be given for free via the -XDeriveFunctorK language extension. Often this instance must be derived as a standalone (-XStandaloneDeriving): 'deriving instance Functor (MyEffect m) If the effect doesn't use m whatsoever it is said to be  first-order3. First-order effects can be given an instance of  for free with -XDeriveAnyClass. "deriving instance Effect MyEffect polysemy!Provide a specialised version of ³r to work around versions of GHC that cannot express the quantified constraint '(" m. Functor m => Functor (e m))'This must always be equal to ³S, and can be removed once GHC 8.6 is the minimum version supported by this librarypolysemyšHigher-order effects require the ability to distribute state from other effects throughout themselves. This state is given by an initial piece of state s ()Q, and a distributive law that describes how to move the state through an effect.When the effect e" has multiple computations in the m monad, L defines the semantics for how these computations will view with the state:’If the resulting state from one computation is fed to another, the second computation will see the state that results from the first computation.’If instead it is given the intial state, both computations will see the same state, but the result of (at least) one will necessarily be ignored. polysemy#Lift a natural transformation from m to n over the effect.   should be defined as  G, but can be hand-written if the default performance isn't sufficient. polysemyA default implementation of  e. Particularly performance-sensitive effects should give a hand-written their own implementation of  .    Safe&'-.14>DHSUVX_k0Œ polysemyAn effect for providing .  Safe&'.14>DHSUVX_k;\ polysemy!An effect which allows a regular “ m into the  ecosystem. Monadic actions in m can be lifted into  via .-For example, you can use this effect to lift µ actions directly into :  (putStrLn "hello") ::  ( IO) r =>  r () JThat being said, you lose out on a significant amount of the benefits of  by using ¹ directly in application code; doing so will tie your application code directly to the underlying monad, and prevent you from interpreting it differently. For best results, only use   in your effect interpreters.Consider using  and  as a substitute for using ¶ directly.  Safe&'.149>DHSUVX_k=polysemyAn effect corresponding to the   typeclass.!Safe&'-.14>DHSUVX_k=ś·ø"Safe&'-.14>DHSUVX_k>ÉNone&',-.14=>?@ADHSUVX_kmR polysemyA singleton for .polysemy'The kind of type-level natural numbers.polysemyA proof that the effect e4 is available somewhere inside of the effect stack r.polysemy$An extensible, type-safe union. The rZ type parameter is a type-level list of effects, any one of which may be held within the . polysemy Decompose a '. Either this union contains an effect e---the head of the r list---or it doesn't.!polysemyRetrieve the last effect in a ."polysemy@An empty union contains nothing, so this function is uncallable.#polysemy Weaken a 2 so it is capable of storing a new sort of effect.$polysemyLike #9, but introduces a new effect under the top of the stack.%polysemyLike #9, but introduces a new effect under the top of the stack.&polysemyLike #9, but introduces a new effect under the top of the stack.'polysemyLift an effect e into a  capable of holding it.(polysemyAttempt to take an e effect out of a .)polysemyLike  #, but allows for a more efficient #$ function.polysemy'A proof that the effect is actually in r.polysemy"The effect to wrap. The functions ( and  % can help retrieve this value later. !"#$%&'()'#$%& (!")None&'-.14=>?DHSUVX_k Į1polysemyvMakes constraints of functions that use multiple effects shorter by translating single list of effects into multiple  constraints: foo :: 1 '[ % Int , % Bool , &# String ] r => 2 r () translates into:  foo :: (  (% Int) r ,  (% Bool) r ,  (& String) r ) => 2 r () 2polysemyThe 2N monad handles computations of arbitrary extensible effects. A value of type Sem r/ describes a program with the capabilities of r. For best results, rJ should always be kept polymorphic, but you can add capabilities via the  constraint.The value of the 2Ę monad is that it allows you to write programs against a set of effects without a predefined meaning, and provide that meaning later. For example, unlike with mtl, you can decide to interpret an  ' effect tradtionally as an ¹), or instead significantly faster as an µ ()~. These interpretations (and others that you might add) may be used interchangably without needing to write any newtypes or “V instances. The only change needed to swap interpretations is to change a call from  * to  +.The effect stack r` can contain arbitrary other monads inside of it. These monads are lifted into effects via the  . effect. Monadic values can be lifted into a 2 via =.A 2) can be interpreted as a pure value (via >) or as any traditional “ (via ?). Each effect E4 comes equipped with some interpreters of the form: runE :: 2 (E ': r) a -> 2 r a -which is responsible for removing the effect Eƒ from the effect stack. It is the order in which you call the interpreters that determines the monomorphic representation of the r parameter.EAfter all of your effects are handled, you'll be left with either a 2 '[] a or a 2 '[   m ] a/ value, which can be consumed respectively by > and ?.ExamplesAs an example of keeping r& polymorphic, we can consider the type  ( & String) r => 2 r () to be a program with access to  , :: 2 r String  - :: String -> 2 r () methods.By also adding a  (' Bool) r constraint on r, we gain access to the  . :: Bool -> 2 r a  / :: 2 r a -> (Bool -> 2 r a) -> 2 r a functions as well.In this sense, a  ( & s) r# constraint is analogous to mtl's 01 s m- and should be thought of as such. However, unlike mtl, a 28 monad may have an arbitrary number of the same effect.For example, we can write a 2" program which can output either ŗs or »s:  foo :: (  (% Int) r ,  (% Bool) r ) => 2 r () foo = do 2 @Int 5 2 True Notice that we must use -XTypeApplications( to specify that we'd like to use the (% ŗ ) effect.5polysemyLike 4- but flipped for better ergonomics sometimes.8polysemyIntroduce an effect into 2. Analogous to 34 in the mtl ecosystem9polysemyLike 8@, but introduces a new effect uunderneath the head of the list.:polysemyLike 8C, but introduces two new effects uunderneath the head of the list.;polysemyLike 8C, but introduces two new effects uunderneath the head of the list.<polysemyLift an effect into a 2. This is used primarily via 5! to implement smart constructors.=polysemyLift a monadic action m into 2.>polysemyRun a 2' containing no effects as a pure value.?polysemyLower a 2! containing only a single lifted “ into that monad.@polysemyJSome interpreters need to be able to lower down to the base monad (often µD) in order to function properly --- some good examples of this are  + and  6.THowever, these interpreters don't compose particularly nicely; for example, to run  6, you must write: runM . runErrorInIO runM  Notice that ?‹ is duplicated in two places here. The situation gets exponentially worse the more intepreters you have that need to run in this pattern. Instead, @@ performs the composition we'd like. The above can be written as (runM .@ runErrorInIO) ]The parentheses here are important; without them you'll run into operator precedence errors.Warning: This combinator will duplicate works that is intended to be just for initialization. This can result in rather surprising behavior. For a version of @$ that won't duplicate work, see the .@! operator in  Uhttp://hackage.haskell.org/package/polysemy-zoo/docs/Polysemy-IdempotentLowering.html polysemy-zoo.ApolysemyLike @@, but for interpreters which change the resulting type --- eg.  +.Bpolysemy§Due to a quirk of the GHC plugin interface, it's only easy to find transitive dependencies if they define an orphan instance. This orphan instance allows us to find Polysemy.Internal in the polysemy-plugin.DpolysemyThis instance will only lift µ/ actions. If you want to lift into some other ¼1 type, use this instance, and handle it via the  7 interpretation.@polysemyThe lowering function, likely ?.ApolysemyThe lowering function, likely ?. 123456789:;<=>?@A2341<=>?89:; 567@A@8A8None&'-.14>DHSUVX_kĢ!MpolysemyM‹ is an environment in which you're capable of explicitly threading higher-order effect states. This is provided by the (internal) effect Tacticsa, which is capable of rewriting monadic actions so they run in the correct stateful environment. Inside a M, you're capable of running O, P and QG which are the main tools for rewriting monadic stateful environments.:For example, consider trying to write an interpreter for  8, whose effect is defined as: data  8 m a where  9( :: m a -> (a -> m ()) -> (a -> m b) ->  8 m b Here we have an m aF which clearly needs to be run first, and then subsequently call the  a -> m () and a -> m b arguments. In a M6 environment, we can write the threading code thusly:  9' alloc dealloc use -> do alloc' <- P alloc dealloc' <- Q dealloc use' <- Q use where alloc' ::  ( 8" ': r) (f a1) dealloc' :: f a1 ->  ( 8" ': r) (f ()) use' :: f a1 ->  ( 8 ': r) (f x) The fh type here is existential and corresponds to "whatever state the other effects want to keep track of." f is always a ².alloc', dealloc' and use'š are now in a form that can be easily consumed by your interpreter. At this point, simply bind them in the desired order and continue on your merry way.We can see from the types of dealloc' and use'! that since they both consume a f a1U, they must run in the same stateful environment. This means, for illustration, any  -s run inside the use* block will not be visible inside of the dealloc block.Power users may explicitly use N and QT to construct whatever data flow they'd like; although this is usually unnecessary.NpolysemyCGet the stateful environment of the world at the moment the effect e is to be run. Prefer O, P or Q* instead of using this function directly.OpolysemyLift a value into M.PpolysemyRun a monadic action in a Mj environment. The stateful environment used will be the same one that the effect is initally run in. Use QA if you'd prefer to explicitly manage your stateful environment.QpolysemyBLift a kleisli action into the stateful environment. You can use Q( to get an effect parameter of the form a -> m b0 into something that can be used after calling P on an effect parameter m a.RpolysemyZInternal function to create first-order interpreter combinators out of higher-order ones.SpolysemyRun the I effect.PpolysemyHThe monadic action to lift. This is usually a parameter in your effect.QpolysemyNThe monadic continuation to lift. This is usually a parameter in your effect.Continuations lifted via Q6 will run in the same environment which produced the a. IJKLMNOPQRS IJKNPQORSML:None&'-.14>DHPSUVX_kä“ TpolysemyIf TY is a GADT representing an effect algebra, as described in the module documentation for Polysemy, $(T ''T)L automatically generates a smart constructor for every data constructor of T.UpolysemyLike TŠ, but does not provide type signatures. This can be used to attach Haddock comments to individual arguments for each generated function. Ędata Lang m a where Output :: String -> Lang () makeSem_ ''Lang -- | Output a string. output :: Member Lang r => String -- ^ String to output. -> Sem r () -- ^ No result.  Note that U must be used before the explicit type signatures.½polysemy]Generates declarations and possibly signatures for functions to lift GADT constructors into 2 actions.¾polysemy\Given the name of a GADT constructor, return the name of the corresponding lifted function.æpolysemy)Builds a function definition of the form x a b c = send $ X a b c.ĄpolysemyHGenerates a function type from the corresponding GADT type constructor 2x :: Member (Effect e) r => a -> b -> c -> Sem r r.ĮpolysemynTurn all (KindedTV tv StarT) into (PlainTV tv) in the given type This can prevent the need for KindSignaturesĀpolysemyoTurn TvVarBndrs of the form (KindedTV tv StarT) into (PlainTV tv) This can prevent the need for KindSignaturesĆpolysemy(Generates a type signature of the form 2x :: Member (Effect e) r => a -> b -> c -> Sem r r.ÄpolysemyFolds a list of Å!s into a right-associative arrow Å.TUTU None&'-.14>DHSUVX_kŖĘpolysemyA lazier version of ;<.VpolysemyDThe simplest way to produce an effect handler. Interprets an effect e2 by transforming it into other effects inside of r.WpolysemyLike VA, but for higher-order effects (ie. those which make use of the m parameter.)See the notes on M for how to use this function.ĒpolysemyKA highly-performant combinator for interpreting an effect statefully. See X3 for a more user-friendly variety of this function.ČpolysemyKA highly-performant combinator for interpreting an effect statefully. See X3 for a more user-friendly variety of this function.XpolysemyLike V+, but with access to an intermediate state s.YpolysemyLike V+, but with access to an intermediate state s.ZpolysemyLike [, but for higher-order effects.See the notes on M for how to use this function.[polysemyLike V%, but instead of removing the effect e#, reencodes it in some new effect f,. This function will fuse when followed by  =, meaning it's free to [ in terms of the  & effect and immediately run it.\polysemyLike ], but for higher-order effects.See the notes on M for how to use this function.]polysemyLike [, but introduces two intermediary effects.^polysemyLike _, but for higher-order effects.See the notes on M for how to use this function._polysemyLike [, but introduces three intermediary effects.`polysemyLike Vŗ, but instead of handling the effect, allows responding to the effect while leaving it unhandled. This allows you, for example, to intercept other effects and insert logic around them.apolysemyLike a, but for higher-order effects.See the notes on M for how to use this function. VpolysemyNA natural transformation from the handled effect to other effects already in 2.WpolysemyNA natural transformation from the handled effect to other effects already in 2.ZpolysemyCA natural transformation from the handled effect to the new effect.[polysemyCA natural transformation from the handled effect to the new effect.\polysemyDA natural transformation from the handled effect to the new effects.]polysemyDA natural transformation from the handled effect to the new effects.^polysemyDA natural transformation from the handled effect to the new effects._polysemyDA natural transformation from the handled effect to the new effects.`polysemyNA natural transformation from the handled effect to other effects already in 2.polysemyUnlike V, ` does not consume any effects.apolysemyNA natural transformation from the handled effect to other effects already in 2.polysemyUnlike W, a does not consume any effects. VWXYZ[\]^_`a V`[]_WaZ\^XYNone&'-.14>DHSUVX_kŃ# 128=>?@ALMNOPQTUVWZ[\]^_`abcde#21>? =8TUV`[]_WaZ\^@AMLNOPQbcde None&'-.14>DHSUVX_kIfpolysemyIf you trying to run 2 in µ, the function you want is ?.The ¼, class is conceptually an interpretation of µP to some other monad. This function reifies that intuition, by transforming an µ effect into some other ¼.2This function is especially useful when using the ¼ instance for 2 instance.$Make sure to type-apply the desired ¼ instance when using f.Example foo :: PandocIO () foo = ? . f @PandocIO $ do É" $ putStrLn "hello from polysemy" ffNone&'-.14>DHSUVX_k²gpolysemyRun a   effect purely.hpolysemyRun a  " effect in terms of an underlying Ź instance. gh gh None&'-.14>DHSUVX_k!šnpolysemyRun an i effect in the style of >?.opolysemyRun an i effect as an µ Ė4. This interpretation is significantly faster than n%, at the cost of being less flexible.opolysemyStrategy for lowering a 2 action down to µ&. This is likely some combination of ?$ and other interpters composed via @.ikjlmnoikjlmnoNone&'-.149>DHSUVX_k&yĢpolysemyŖA higher-order function receiving two parameters: a function to combine each solution with the rest of the solutions, and an action to run when no results are produced.rpolysemyRun a $ effect in terms of some underlying Ķ f.rr None&'-.14>DHSUVX_k/ØwpolysemyAn effect capable of providing Ή semantics. Interpreters for this will successfully run the deallocation action even in the presence of other short-circuiting effects.zpolysemyRun a w effect via in terms of Ī.xpolysemyAction to allocate a resource.polysemyAAction to cleanup the resource. This is guaranteed to be called.polysemyAction which uses the resource.zpolysemyStrategy for lowering a 2 action down to µ&. This is likely some combination of ?% and other interpreters composed via @.wxyzwxyz None&'-.14>DHSUVX_k;%{polysemy>An effect for providing statefulness. Note that unlike mtl's @A#, there is no restriction that the {$ effect corresponds necessarily to locala state. It could could just as well be interrpeted in terms of HTTP requests or database access.,Interpreters which require statefulness can [ themselves in terms of {, and subsequently call ‚.‚polysemyRun a { effect with local state.ƒpolysemyRun a {! effect with local state, lazily.„polysemyRun a {3 effect by transforming it into operations over an Ļ.…polysemyHoist a { effect into a Š` monad transformer. This can be useful when writing interpreters that need to interop with MTL. {|}~€‚ƒ„… {|}~€‚ƒ„…None&'*-.14>DHSUVX_k>Ö†polysemyAn effect capable of providing Ń values.‹polysemyRun a † effect with an explicit Ņ.ŒpolysemyRun a † effect by using the µ random generator.†‡ˆ‰Š‹Œ†‡ˆ‰Š‹ŒNone&'*-.14>DHSUVX_kE׍polysemyTAn effect capable of sending messages. Useful for streaming output and for logging.polysemyRun an ) effect by transforming it into a monoid.‘polysemyRun an  effect by ignoring it.’polysemy Accumulate 6s so they are delayed until they reach at least size size.If sizeD is 0, this interpretation will not emit anything in the resulting  effect.Ž‘’Ž‘’None&'*-.14>DHSUVX_kL„“polysemy^An effect which can provide input to an application. Useful for dealing with streaming input.–polysemyRun an “- effect by always giving back the same value.—polysemyRun an “G effect by providing a different element of a list each time. Returns Ó after the list is exhausted.˜polysemyRuns an “8 effect by evaluating a monadic action for each request.“”•–—˜“”•–—˜None&'-.14>DHSUVX_kOā™polysemyAn effect corresponding to BC.ŸpolysemyRun a ™ effect with a constant value. polysemy Transform an “ effect into a ™ effect.™š›œžŸ ™š›œžŸ None&'-.14>DHSUVX_kUG”polysemyAn effect for logging strings.¤polysemyRun a ”+ effect by printing the messages to stdout.„polysemyRun a ”( effect by ignoring all of its messages.¦polysemy Transform a ” effect into a  Ō effect.§polysemy Transform a ” effect into a  Ō effect.”¢£¤„¦§”¢£¤„¦§None&'*-.14>DHPSUVX_kYˆØpolysemy8An effect capable of emitting and intercepting messages.Æpolysemy Transform an  effect into a Ø effect.°polysemyRun a Ø effect in the style of DE% (but without the nasty space leak!) ØŖ©«¬­®Æ° ØŖ©«¬­®°ÆÕFGHIJKLMNOPQQRSTU"VWXYZ[\]]^^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ:5:‘ ’ “ ” • – $ — ˜ ™ š › œžŸ  7”¢ ' £ ¤ . / * + „ ¦§Ø©Ŗ« 8 9 ¬ 6 & ­ ® , - Æ ° = ± ² ³““µ¶·ø¹%%2ŗ»¼½½¾æĄĮĀĆÄÅĘĒČÉŹŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŲŁŪŲŁÜŻŽßŲąį!ā!ćŲäåŻŽꯎēŲčé:ź:ė:ģ:ķ:ī:ļ:š:ńņóō < õ öŲč÷ŲųŲł)śŲŁ Ųū¬Ųüżž’A“ŲŲŁ'polysemy-0.2.0.0-3bWzW4QMyDTKXanmRejxIwPolysemy.Internal.CustomErrorsPolysemy.Internal.EffectPolysemy.FixpointPolysemyPolysemy.NonDetPolysemy.Internal.UnionPolysemy.InternalPolysemy.Internal.TacticsPolysemy.Internal.Combinators Polysemy.IOPolysemy.ErrorPolysemy.ResourcePolysemy.StatePolysemy.RandomPolysemy.OutputPolysemy.InputPolysemy.ReaderPolysemy.TracePolysemy.WriterSemPolysemy.Internal.FixpointControl.Monad.FixmfixPolysemy.Internal.LiftsendMMemberLifttrace runTraceIOPolysemy.Internal.NonDetControl.Applicative AlternativePolysemy.Internal.PluginLookup Polysemy.Internal.TH.PerformancePolysemy.Interpretation reinterpretOutputStateErrorControl.Exception ExceptionrunError runErrorInIOgetputthrowcatchControl.Monad.State.Class MonadStateoutputControl.Monad.Class.TransliftmakeSem runResourcerunIOResourceBracketPolysemy.Internal.TH.Effect Data.TupleswaprunStateControl.Monad.Trans.ExceptExceptTControl.Monad.Trans.StateStateTControl.Monad.Trans.ReaderReaderTControl.Monad.Trans.WriterWriterTUnhandledEffect FirstOrder AmbiguousSendBreakDefiningModuleForEffectDefiningModuleEffectfmap'weavehoist defaultHoistFixpointunLiftNonDetEmptyChooseinlineRecursiveCallsSNatSZSSNatZSYoUnionliftYodecompextractabsurdUweaken weakenUnder weakenUnder2 weakenUnder3injprj decompCoerce $fEffectYo $fFunctorYo$fTestEqualityNatSNat $fEffectUnion$fFunctorUnion $fFindk:t $fFindk:t0MembersrunSemusingSemliftSemhoistSemraise raiseUnder raiseUnder2 raiseUnder3sendrunrunM.@.@@$fPluginLookupTYPEPlugin $fMonadFixSem $fMonadIOSem$fAlternativeSem $fMonadSem$fApplicativeSem $fFunctorSemTacticsGetInitialStateHoistInterpretation WithTacticsTacticalgetInitialStateTpureTrunTbindTliftT runTacticsmakeSem_ interpret interpretHstatefullazilyStateful reinterpretH reinterpret2H reinterpret2 reinterpret3H reinterpret3 intercept interceptHSemantic runSemantic makeSemantic makeSemantic_ runFixpoint runFixpointMThrowCatch$fExceptionWrappedExc$fShowWrappedExc runNonDet$fMonadNonDetC$fAlternativeNonDetC$fApplicativeNonDetC$fFunctorNonDetCbracketGetPutgetsmodify runLazyStaterunStateInIORefhoistStateIntoStateTRandomRandomRrandomrandomR runRandom runRandomIOrunFoldMapOutputrunIgnoringOutputrunBatchOutputInputinput runConstInput runListInputrunMonadicInputReaderAskLocalasklocalasks runReaderrunInputAsReaderTracerunIgnoringTracerunTraceAsOutputrunOutputAsTraceWriterTellListenCensortelllistencensorrunOutputAsWriter runWriterUnhandledEffectMsgbaseGHC.BaseFunctorfmapMonadghc-prim GHC.TypesIO System.IOputStrLnPlugin PluginLookup Data.EitherEitherIntBoolControl.Monad.IO.ClassMonadIOgenFreer getDeclNamegenDeclgenType simplifyBndrs simplifyBndrgenSig foldArrowstemplate-haskellLanguage.Haskell.TH.SyntaxTypeinterpretInStateTinterpretInLazyStateTliftIOMonadFixGHC.Exception.Type unNonDetCControl.Exception.Base GHC.IORefIOReftransformers-0.5.5.0Control.Monad.Trans.State.Lazy!random-1.1-3ypV4EIycgb35PKjTYYr5q System.Random RandomGen GHC.MaybeNothingString