bound-1.0.7: Making de Bruijn Succ Less

Copyright(C) 2012 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellTrustworthy
LanguageHaskell98

Bound.Var

Description

 

Synopsis

Documentation

data Var b a Source

"I am not a number, I am a free monad!"

A Var b a is a variable that may either be "bound" (B) or "free" (F).

(It is also technically a free monad in the same near-trivial sense as Either.)

Constructors

B b

this is a bound variable

F a

this is a free variable

unvar :: (b -> r) -> (a -> r) -> Var b a -> r Source

_B :: (Choice p, Applicative f) => p b (f b') -> p (Var b a) (f (Var b' a)) Source

This provides a Prism that can be used with lens library to access a bound Var.

_B :: Prism (Var b a) (Var b' a) b b'@

_F :: (Choice p, Applicative f) => p a (f a') -> p (Var b a) (f (Var b a')) Source

This provides a Prism that can be used with lens library to access a free Var.

_F :: Prism (Var b a) (Var b a') a a'@