freer-simple-1.2.1.0: Implementation of a friendly effect system for Haskell.

Copyright(c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.; 2017 Alexis King
LicenseBSD3
MaintainerAlexis King <lexi.lambda@gmail.com>
Stabilityexperimental
PortabilityGHC specific language extensions.
Safe HaskellNone
LanguageHaskell2010

Control.Monad.Freer.Fresh

Description

Composable handler for Fresh effects. This is likely to be of use when implementing De Bruijn naming/scopes.

Using http://okmij.org/ftp/Haskell/extensible/Eff1.hs as a starting point.

Synopsis

Documentation

data Fresh r where Source #

Fresh effect model.

Constructors

Fresh :: Fresh Int 

fresh :: Member Fresh effs => Eff effs Int Source #

Request a fresh effect.

runFresh :: Int -> Eff (Fresh ': effs) a -> Eff effs (a, Int) Source #

Handler for Fresh effects, with an Int for a starting value. The return value includes the next fresh value.

evalFresh :: Int -> Eff (Fresh ': effs) a -> Eff effs a Source #

Handler for Fresh effects, with an Int for a starting value. Discards the next fresh value.