bound-1.0.6: 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

Instances

Bitraversable Var 
Bifunctor Var 
Bifoldable Var 
Serial2 Var 
Hashable2 Var 
Eq2 Var 
Ord2 Var 
Show2 Var 
Read2 Var 
Monad (Var b) 
Functor (Var b) 
Applicative (Var b) 
Foldable (Var b) 
Traversable (Var b) 
Serial b => Serial1 (Var b) 
Hashable b => Hashable1 (Var b) 
Eq b => Eq1 (Var b) 
Ord b => Ord1 (Var b) 
Show b => Show1 (Var b) 
Read b => Read1 (Var b) 
(Eq b, Eq a) => Eq (Var b a) 
(Data b, Data a) => Data (Var b a) 
(Ord b, Ord a) => Ord (Var b a) 
(Read b, Read a) => Read (Var b a) 
(Show b, Show a) => Show (Var b a) 
Generic (Var b a) 
(Binary b, Binary a) => Binary (Var b a) 
(Serial b, Serial a) => Serial (Var b a) 
(Serialize b, Serialize a) => Serialize (Var b a) 
(Hashable b, Hashable a) => Hashable (Var b a) 
Typeable (* -> * -> *) Var 
type Rep (Var b a) 

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'@