supply-chain-0.0.1.0: Composable request-response pipelines
Safe HaskellSafe-Inferred
LanguageGHC2021

SupplyChain.Job

Description

A job makes requests, performs actions, and returns

Synopsis

Type

data Job (up :: Type -> Type) (action :: Type -> Type) product #

Monadic context that supports making requests, performing actions, and returning a single result

Instances

Instances details
Applicative (Job up action) 
Instance details

Defined in SupplyChain.Core.Job

Methods

pure :: a -> Job up action a #

(<*>) :: Job up action (a -> b) -> Job up action a -> Job up action b #

liftA2 :: (a -> b -> c) -> Job up action a -> Job up action b -> Job up action c #

(*>) :: Job up action a -> Job up action b -> Job up action b #

(<*) :: Job up action a -> Job up action b -> Job up action a #

Functor (Job up action) 
Instance details

Defined in SupplyChain.Core.Job

Methods

fmap :: (a -> b) -> Job up action a -> Job up action b #

(<$) :: a -> Job up action b -> Job up action a #

Monad (Job up action) 
Instance details

Defined in SupplyChain.Core.Job

Methods

(>>=) :: Job up action a -> (a -> Job up action b) -> Job up action b #

(>>) :: Job up action a -> Job up action b -> Job up action b #

return :: a -> Job up action a #

Construction

perform Source #

Arguments

:: action product

Action

-> Job up action product

Job

order Source #

Arguments

:: up product

Request

-> Job up action product

Job

effect Source #

Arguments

:: Effect up action product

Effect

-> Job up action product

Job

Running

run Source #

Arguments

:: Monad action 
=> Job (Const Void) action product

Job

-> action product

Action

Run a job in its action context

The job must not make requests, so its upstream interface is Const Void.

eval Source #

Arguments

:: Job (Const Void) (Const Void) product

Job

-> product

Result

Evaluate a job with no context

The job must evokes neither request nor actions, so both its upstream and action contexts are Const Void.

Alteration

alter Source #

Arguments

:: (forall x. Effect up action x -> Job up' action' x)

Transformation applied to each effect that the job evokes

-> Job up action product 
-> Job up' action' product 

alter' Source #

Arguments

:: (forall x. Effect up action x -> Effect up' action' x)

Transformation applied to each effect that the job evokes

-> Job up action product 
-> Job up' action' product