polysemy-conc-0.3.0.0: Polysemy Effects for Concurrency
Safe HaskellNone
LanguageHaskell2010

Polysemy.Conc.Interpreter.Scoped

Description

 
Synopsis

Documentation

runScoped :: forall resource effect r. (forall x. (resource -> Sem r x) -> Sem r x) -> (resource -> InterpreterFor effect r) -> InterpreterFor (Scoped resource effect) r Source #

Interpreter for Scoped, taking a resource allocation function and a parameterized interpreter for the plain effect.

withResource is a callback function, allowing the user to acquire the resource for each program from other effects.

scopedInterpreter is a regular interpreter that is called with the resource argument produced by scope. Note: This function will be called for each action in the program, so if the interpreter allocates any resources, they will be scoped to a single action. Move them to withResource instead.

runScopedAs :: forall resource effect r. Sem r resource -> (resource -> InterpreterFor effect r) -> InterpreterFor (Scoped resource effect) r Source #

Variant of Scoped in which the resource allocator is a plain action.