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
Bitraversable Var Source # 
Instance details

Defined in Bound.Var

Methods

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

Bifoldable Var Source # 
Instance details

Defined in Bound.Var

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 #

Bifunctor Var Source # 
Instance details

Defined in Bound.Var

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 #

Eq2 Var Source # 
Instance details

Defined in Bound.Var

Methods

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

Ord2 Var Source # 
Instance details

Defined in Bound.Var

Methods

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

Read2 Var Source # 
Instance details

Defined in Bound.Var

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] #

liftReadPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec (Var a b) #

liftReadListPrec2 :: ReadPrec a -> ReadPrec [a] -> ReadPrec b -> ReadPrec [b] -> ReadPrec [Var a b] #

Show2 Var Source # 
Instance details

Defined in Bound.Var

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 #

Serial2 Var Source # 
Instance details

Defined in Bound.Var

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 # 
Instance details

Defined in Bound.Var

Methods

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

Monad (Var b) Source # 
Instance details

Defined in Bound.Var

Methods

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

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

return :: a -> Var b a #

fail :: String -> Var b a #

Functor (Var b) Source # 
Instance details

Defined in Bound.Var

Methods

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

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

Applicative (Var b) Source # 
Instance details

Defined in Bound.Var

Methods

pure :: a -> Var b a #

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

liftA2 :: (a -> b0 -> c) -> Var b a -> Var b b0 -> Var b c #

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

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

Foldable (Var b) Source # 
Instance details

Defined in Bound.Var

Methods

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

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

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

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

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

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

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 # 
Instance details

Defined in Bound.Var

Methods

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

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

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

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

Eq b => Eq1 (Var b) Source # 
Instance details

Defined in Bound.Var

Methods

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

Ord b => Ord1 (Var b) Source # 
Instance details

Defined in Bound.Var

Methods

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

Read b => Read1 (Var b) Source # 
Instance details

Defined in Bound.Var

Methods

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

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

liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (Var b a) #

liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [Var b a] #

Show b => Show1 (Var b) Source # 
Instance details

Defined in Bound.Var

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 # 
Instance details

Defined in Bound.Var

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 # 
Instance details

Defined in Bound.Var

Methods

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

Generic1 (Var b :: Type -> Type) Source # 
Instance details

Defined in Bound.Var

Associated Types

type Rep1 (Var b) :: k -> Type #

Methods

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

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

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

Defined in Bound.Var

Methods

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

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

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

Defined in Bound.Var

Methods

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

gunfold :: (forall b0 r. Data b0 => c (b0 -> 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 b0. Data b0 => b0 -> b0) -> 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 b, Ord a) => Ord (Var b a) Source # 
Instance details

Defined in Bound.Var

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 b, Read a) => Read (Var b a) Source # 
Instance details

Defined in Bound.Var

Methods

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

readList :: ReadS [Var b a] #

readPrec :: ReadPrec (Var b a) #

readListPrec :: ReadPrec [Var b a] #

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

Defined in Bound.Var

Methods

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

show :: Var b a -> String #

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

Generic (Var b a) Source # 
Instance details

Defined in Bound.Var

Associated Types

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

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 # 
Instance details

Defined in Bound.Var

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 # 
Instance details

Defined in Bound.Var

Methods

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

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

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

Defined in Bound.Var

Methods

put :: Putter (Var b a) #

get :: Get (Var b a) #

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

Defined in Bound.Var

Methods

rnf :: Var b a -> () #

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

Defined in Bound.Var

Methods

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

hash :: Var b a -> Int #

type Rep1 (Var b :: Type -> Type) Source # 
Instance details

Defined in Bound.Var

type Rep (Var b a) Source # 
Instance details

Defined in Bound.Var

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