úÎ!e¬Yâ³      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ [ \]^_`abcdefgh ijk l m n o p q r s tuvwxy z { | } ~  € ‚ ƒ „ … † ‡ ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²None&',-.14>DHSUVX_kH³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;v 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=5polysemyAn 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 underneath the head of the list.:polysemyLike 8B, but introduces two new effects underneath the head of the list.;polysemyLike 8B, but introduces two new effects underneath 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Ì/OpolysemyO‹ 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 O, you're capable of running Q, R and SG 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 O6 environment, we can write the threading code thusly:  9' alloc dealloc use -> do alloc' <- R alloc dealloc' <- S dealloc use' <- S 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 P and ST to construct whatever data flow they'd like; although this is usually unnecessary.PpolysemyCGet the stateful environment of the world at the moment the effect e is to be run. Prefer Q, R or S* instead of using this function directly.QpolysemyLift a value into O.RpolysemyRun a monadic action in a Oj environment. The stateful environment used will be the same one that the effect is initally run in. Use SA if you'd prefer to explicitly manage your stateful environment.SpolysemyBLift a kleisli action into the stateful environment. You can use S( to get an effect parameter of the form a -> m b0 into something that can be used after calling R on an effect parameter m a.TpolysemyZInternal function to create first-order interpreter combinators out of higher-order ones.UpolysemyRun the K effect.RpolysemyHThe monadic action to lift. This is usually a parameter in your effect.SpolysemyNThe monadic continuation to lift. This is usually a parameter in your effect.Continuations lifted via S6 will run in the same environment which produced the a. KLMNOPQRSTU KLMPRSQTUON:None&'-.14>DHPSUVX_kä¡ VpolysemyIf TY is a GADT representing an effect algebra, as described in the module documentation for Polysemy, $(V ''T)L automatically generates a smart constructor for every data constructor of T.WpolysemyLike VŠ, 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 W 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 Ç.VWVW None&'-.14>DHSUVX_k¸ÈpolysemyA lazier version of ;<.XpolysemyDThe simplest way to produce an effect handler. Interprets an effect e2 by transforming it into other effects inside of r.YpolysemyLike XA, but for higher-order effects (ie. those which make use of the m parameter.)See the notes on O for how to use this function.ÉpolysemyKA highly-performant combinator for interpreting an effect statefully. See Z3 for a more user-friendly variety of this function.ÊpolysemyKA highly-performant combinator for interpreting an effect statefully. See Z3 for a more user-friendly variety of this function.ZpolysemyLike X+, but with access to an intermediate state s.[polysemyLike X+, but with access to an intermediate state s.\polysemyLike ], but for higher-order effects.See the notes on O for how to use this function.]polysemyLike X%, 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 O for how to use this function._polysemyLike ], but introduces two intermediary effects.`polysemyLike a, but for higher-order effects.See the notes on O for how to use this function.apolysemyLike ], but introduces three intermediary effects.bpolysemyLike Xº, 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.cpolysemyLike c, but for higher-order effects.See the notes on O for how to use this function. XpolysemyNA natural transformation from the handled effect to other effects already in 2.YpolysemyNA natural transformation from the handled effect to other effects already in 2.\polysemyCA 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.apolysemyDA natural transformation from the handled effect to the new effects.bpolysemyNA natural transformation from the handled effect to other effects already in 2.polysemyUnlike X, b does not consume any effects.cpolysemyNA natural transformation from the handled effect to other effects already in 2.polysemyUnlike Y, c does not consume any effects. XYZ[\]^_`abc Xb]_aYc\^`Z[None&'-.14>DHSUVX_kß# 128=>?@ANOPQRSVWXY\]^_`abcdefg#21>? =8VWXb]_aYc\^`@AONPQRSdefg None&'-.14>DHSUVX_kWhpolysemyIf 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 h.Example foo :: PandocIO () foo = ? . h @PandocIO $ do Ë" $ putStrLn "hello from polysemy" hhNone&'-.14>DHSUVX_kÀipolysemyRun a   effect purely.jpolysemyRun a  " effect in terms of an underlying Ì instance. ij ij None&'-.14>DHSUVX_k!¨ppolysemyRun an k effect in the style of >?.qpolysemyRun an k effect as an · Í4. This interpretation is significantly faster than p%, at the cost of being less flexible.qpolysemyStrategy for lowering a 2 action down to ·&. This is likely some combination of ?$ and other interpters composed via @.kmlnopqkmlnopqNone&'-.149>DHSUVX_k&‡Î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.tpolysemyRun a $ effect in terms of some underlying Ï f.tt None&'-.14>DHSUVX_k/¶ypolysemyAn effect capable of providing Љ semantics. Interpreters for this will successfully run the deallocation action even in the presence of other short-circuiting effects.|polysemyRun a y effect via in terms of Ğ.zpolysemyAction to allocate a resource.polysemyAAction to cleanup the resource. This is guaranteed to be called.polysemyAction which uses the resource.|polysemyStrategy for lowering a 2 action down to ·&. This is likely some combination of ?% and other interpreters composed via @.yz{|yz{| None&'-.14>DHSUVX_k;3}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_kUU£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.1.0-Gt7QGVj877wLSTPuvdop4zPolysemy.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$fMonadFailSem$fMonadPlusSem$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