freer-simple-1.2.1.2: A friendly effect system for Haskell.
Copyright (c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.; 2017 Alexis King
License BSD3
Maintainer Alexis King <lexi.lambda@gmail.com>
Stability experimental
Portability GHC specific language extensions.
Safe Haskell None
Language Haskell2010

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.