polysemy-0.7.0.0: Higher-order, low-boilerplate, zero-cost free monads.

Safe HaskellNone
LanguageHaskell2010

Polysemy.Input

Contents

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
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 a r. MemberWithError (Input a) r => Sem r a Source #

Interpretations

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

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

runListInput :: [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.

runMonadicInput :: 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.