fused-effects-1.0.0.0: A fast, flexible, fused effect system.

Contents

Description

This effect is similar to the traditional MonadReader typeclass, though it allows the presence of multiple Reader t effects.

Predefined carriers:

Since: 0.1.0.0

Synopsis

data Reader r m k Source #

Since: 0.1.0.0

Constructors

 Ask (r -> m k) Local (r -> r) (m b) (b -> m k)
Instances

ask :: Has (Reader r) sig m => m r Source #

Retrieve the environment value.

runReader a (ask >>= k) = runReader a (k a)


Since: 0.1.0.0

asks :: Has (Reader r) sig m => (r -> a) -> m a Source #

Project a function out of the current environment value.

asks f = fmap f ask


Since: 0.1.0.0

local :: Has (Reader r) sig m => (r -> r) -> m a -> m a Source #

Run a computation with an environment value locally modified by the passed function.

runReader a (local f m) = runReader (f a) m


Since: 0.1.0.0

# Re-exports

class (HFunctor sig, Monad m) => Algebra sig m | m -> sig Source #

The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the alg method.

Since: 1.0.0.0

Minimal complete definition

alg

Instances

type Has eff sig m = (Members eff sig, Algebra sig m) Source #

m is a carrier for sig containing eff.

Note that if eff is a sum, it will be decomposed into multiple Member constraints. While this technically allows one to combine multiple unrelated effects into a single Has constraint, doing so has two significant drawbacks:

1. Due to a problem with recursive type families, this can lead to significantly slower compiles.
2. It defeats ghc’s warnings for redundant constraints, and thus can lead to a proliferation of redundant constraints as code is changed.

run :: Identity a -> a Source #

Run an action exhausted of effects to produce its final result value.

Since: 1.0.0.0