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

Eq2 Var Source # 

Methods

liftEq2 :: (a -> b -> Bool) -> (c -> d -> Bool) -> Var a c -> Var b d -> Bool #

Ord2 Var Source # 

Methods

liftCompare2 :: (a -> b -> Ordering) -> (c -> d -> Ordering) -> Var a c -> Var b d -> Ordering #

Read2 Var Source # 

Methods

liftReadsPrec2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> Int -> ReadS (Var a b) #

liftReadList2 :: (Int -> ReadS a) -> ReadS [a] -> (Int -> ReadS b) -> ReadS [b] -> ReadS [Var a b] #

Show2 Var Source # 

Methods

liftShowsPrec2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> Int -> Var a b -> ShowS #

liftShowList2 :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> (Int -> b -> ShowS) -> ([b] -> ShowS) -> [Var a b] -> ShowS #

Bifunctor Var Source # 

Methods

bimap :: (a -> b) -> (c -> d) -> Var a c -> Var b d #

first :: (a -> b) -> Var a c -> Var b c #

second :: (b -> c) -> Var a b -> Var a c #

Bitraversable Var Source # 

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Var a b -> f (Var c d) #

Bifoldable Var Source # 

Methods

bifold :: Monoid m => Var m m -> m #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Var a b -> m #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Var a b -> c #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Var a b -> c #

Serial2 Var Source # 

Methods

serializeWith2 :: MonadPut m => (a -> m ()) -> (b -> m ()) -> Var a b -> m () #

deserializeWith2 :: MonadGet m => m a -> m b -> m (Var a b) #

Hashable2 Var Source # 

Methods

liftHashWithSalt2 :: (Int -> a -> Int) -> (Int -> b -> Int) -> Int -> Var a b -> Int #

Monad (Var b) Source # 

Methods

(>>=) :: Var b a -> (a -> Var b b) -> Var b b #

(>>) :: Var b a -> Var b b -> Var b b #

return :: a -> Var b a #

fail :: String -> Var b a #

Functor (Var b) Source # 

Methods

fmap :: (a -> b) -> Var b a -> Var b b #

(<$) :: a -> Var b b -> Var b a #

Applicative (Var b) Source # 

Methods

pure :: a -> Var b a #

(<*>) :: Var b (a -> b) -> Var b a -> Var b b #

(*>) :: Var b a -> Var b b -> Var b b #

(<*) :: Var b a -> Var b b -> Var b a #

Foldable (Var b) Source # 

Methods

fold :: Monoid m => Var b m -> m #

foldMap :: Monoid m => (a -> m) -> Var b a -> m #

foldr :: (a -> b -> b) -> b -> Var b a -> b #

foldr' :: (a -> b -> b) -> b -> Var b a -> b #

foldl :: (b -> a -> b) -> b -> Var b a -> b #

foldl' :: (b -> a -> b) -> b -> Var b a -> b #

foldr1 :: (a -> a -> a) -> Var b a -> a #

foldl1 :: (a -> a -> a) -> Var b a -> a #

toList :: Var b a -> [a] #

null :: Var b a -> Bool #

length :: Var b a -> Int #

elem :: Eq a => a -> Var b a -> Bool #

maximum :: Ord a => Var b a -> a #

minimum :: Ord a => Var b a -> a #

sum :: Num a => Var b a -> a #

product :: Num a => Var b a -> a #

Traversable (Var b) Source # 

Methods

traverse :: Applicative f => (a -> f b) -> Var b a -> f (Var b b) #

sequenceA :: Applicative f => Var b (f a) -> f (Var b a) #

mapM :: Monad m => (a -> m b) -> Var b a -> m (Var b b) #

sequence :: Monad m => Var b (m a) -> m (Var b a) #

Generic1 (Var b) Source # 

Associated Types

type Rep1 (Var b :: * -> *) :: * -> * #

Methods

from1 :: Var b a -> Rep1 (Var b) a #

to1 :: Rep1 (Var b) a -> Var b a #

Eq b => Eq1 (Var b) Source # 

Methods

liftEq :: (a -> b -> Bool) -> Var b a -> Var b b -> Bool #

Ord b => Ord1 (Var b) Source # 

Methods

liftCompare :: (a -> b -> Ordering) -> Var b a -> Var b b -> Ordering #

Read b => Read1 (Var b) Source # 

Methods

liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (Var b a) #

liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [Var b a] #

Show b => Show1 (Var b) Source # 

Methods

liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> Var b a -> ShowS #

liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [Var b a] -> ShowS #

Serial b => Serial1 (Var b) Source # 

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Var b a -> m () #

deserializeWith :: MonadGet m => m a -> m (Var b a) #

Hashable b => Hashable1 (Var b) Source # 

Methods

liftHashWithSalt :: (Int -> a -> Int) -> Int -> Var b a -> Int #

(Eq a, Eq b) => Eq (Var b a) Source # 

Methods

(==) :: Var b a -> Var b a -> Bool #

(/=) :: Var b a -> Var b a -> Bool #

(Data a, Data b) => Data (Var b a) Source # 

Methods

gfoldl :: (forall d c. Data d => c (d -> c) -> d -> c c) -> (forall g. g -> c g) -> Var b a -> c (Var b a) #

gunfold :: (forall c r. Data c => c (c -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Var b a) #

toConstr :: Var b a -> Constr #

dataTypeOf :: Var b a -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (Var b a)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Var b a)) #

gmapT :: (forall c. Data c => c -> c) -> Var b a -> Var b a #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Var b a -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Var b a -> r #

gmapQ :: (forall d. Data d => d -> u) -> Var b a -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Var b a -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Var b a -> m (Var b a) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Var b a -> m (Var b a) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Var b a -> m (Var b a) #

(Ord a, Ord b) => Ord (Var b a) Source # 

Methods

compare :: Var b a -> Var b a -> Ordering #

(<) :: Var b a -> Var b a -> Bool #

(<=) :: Var b a -> Var b a -> Bool #

(>) :: Var b a -> Var b a -> Bool #

(>=) :: Var b a -> Var b a -> Bool #

max :: Var b a -> Var b a -> Var b a #

min :: Var b a -> Var b a -> Var b a #

(Read a, Read b) => Read (Var b a) Source # 

Methods

readsPrec :: Int -> ReadS (Var b a) #

readList :: ReadS [Var b a] #

readPrec :: ReadPrec (Var b a) #

readListPrec :: ReadPrec [Var b a] #

(Show a, Show b) => Show (Var b a) Source # 

Methods

showsPrec :: Int -> Var b a -> ShowS #

show :: Var b a -> String #

showList :: [Var b a] -> ShowS #

Generic (Var b a) Source # 

Associated Types

type Rep (Var b a) :: * -> * #

Methods

from :: Var b a -> Rep (Var b a) x #

to :: Rep (Var b a) x -> Var b a #

(Binary b, Binary a) => Binary (Var b a) Source # 

Methods

put :: Var b a -> Put #

get :: Get (Var b a) #

putList :: [Var b a] -> Put #

(Serial b, Serial a) => Serial (Var b a) Source # 

Methods

serialize :: MonadPut m => Var b a -> m () #

deserialize :: MonadGet m => m (Var b a) #

(Serialize b, Serialize a) => Serialize (Var b a) Source # 

Methods

put :: Putter (Var b a) #

get :: Get (Var b a) #

(NFData a, NFData b) => NFData (Var b a) Source # 

Methods

rnf :: Var b a -> () #

(Hashable b, Hashable a) => Hashable (Var b a) Source # 

Methods

hashWithSalt :: Int -> Var b a -> Int #

hash :: Var b a -> Int #

type Rep1 (Var b) Source # 
type Rep (Var b a) Source # 

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