polysemy-1.5.0.0: Higher-order, low-boilerplate free monads.
Safe HaskellNone
LanguageHaskell2010

Polysemy.Input

Synopsis

Effect

data Input i m a where Source #

An effect which can provide input to an application. Useful for dealing with streaming input.

Constructors

Input :: Input i m i 

Instances

Instances details
type DefiningModule (Input :: k1 -> k2 -> k1 -> Type) Source # 
Instance details

Defined in Polysemy.Input

type DefiningModule (Input :: k1 -> k2 -> k1 -> Type) = "Polysemy.Input"

Actions

input :: forall i r. MemberWithError (Input i) r => Sem r i Source #

inputs :: forall i j r. Member (Input i) r => (i -> j) -> Sem r j Source #

Apply a function to an input, cf. asks

Interpretations

runInputConst :: i -> Sem (Input i ': r) a -> Sem r a Source #

Run an Input effect by always giving back the same value.

runInputList :: [i] -> Sem (Input (Maybe i) ': r) a -> Sem r a Source #

Run an Input effect by providing a different element of a list each time. Returns Nothing after the list is exhausted.

runInputSem :: forall i r a. Sem r i -> Sem (Input i ': r) a -> Sem r a Source #

Runs an Input effect by evaluating a monadic action for each request.