Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data Process i o :: Effect where
- recv :: forall i o r. Member (Process i o) r => Sem r o
- send :: forall i o r. Member (Process i o) r => i -> Sem r ()
- withProcess :: forall resource i o r. Member (Scoped resource (Process i o)) r => InterpreterFor (Process i o) r
- runProcessIO :: forall i o err r. Member (Process i o !! err) r => InterpretersFor [Output i !! err, Input o !! err] r
Documentation
data Process i o :: Effect where Source #
Abstraction of a process with input and output.
This effect is intended to be used in a scoped manner:
import Polysemy.Resume import Polysemy.Conc import Polysemy.Process import qualified System.Process.Typed as System prog :: Member (Scoped resource (Process Text Text !! err)) r => Sem r Text prog = resumeAs "failed" do withProcess do send "input" recv main :: IO () main = do out <- runConc $ interpretProcessNative (System.proc "cat" []) prog putStrLn out
Instances
type DefiningModule Process Source # | |
Defined in Polysemy.Process.Effect.Process |
withProcess :: forall resource i o r. Member (Scoped resource (Process i o)) r => InterpreterFor (Process i o) r Source #
Create a scoped resource for Process
.