in-other-words-0.1.0.0: A higher-order effect system where the sky's the limit

Control.Effect.Type.Regional

Synopsis

# Documentation

data Regional s m a where Source #

A helper primitive effect for manipulating a region.

Helper primitive effects are effects that allow you to avoid interpreting one of your own effects as a primitive if the power needed from direct access to the underlying monad can instead be provided by the relevant helper primitive effect. The reason why you'd want to do this is that helper primitive effects already have ThreadsEff instances defined for them; so you don't have to define any for your own effect.

The helper primitive effects offered in this library are -- in order of ascending power -- Regional, Optional, BaseControl and Unlift.

The typical use-case of Regional is to lift a natural transformation of a base monad. Hoist and accompaning interpreters is provided as a specialization of Regional for this purpose.

Regional in its most general form lacks a pre-defined interpreter: when not using Hoist, you're expected to define your own interpreter for Regional (treating it as a primitive effect).

Regional is typically used as a primitive effect. If you define a Carrier that relies on a novel non-trivial monad transformer t, then you need to make a a ThreadsEff t (Regional s) instance (if possible). threadRegionalViaOptional can help you with that.

The following threading constraints accept Regional:

• ReaderThreads
• StateThreads
• StateLazyThreads
• ErrorThreads
• WriterThreads
• WriterLazyThreads
• NonDetThreads
• SteppedThreads
• ContThreads

Constructors

 Regionally :: s -> m a -> Regional s m a

#### Instances

Instances details