debruijn-safe-0.2: de Bruijn indices and levels
Safe HaskellSafe
LanguageHaskell2010

DeBruijn.Lvl

Synopsis

Documentation

data Lvl ctx Source #

de Bruijn levels.

Instances

Instances details
Sinkable Lvl Source # 
Instance details

Defined in DeBruijn.Lvl

Methods

mapLvl :: forall (ctx :: Ctx) (ctx' :: Ctx). Lte ctx ctx' -> Lvl ctx -> Lvl ctx' Source #

Show (Lvl ctx) Source # 
Instance details

Defined in DeBruijn.Lvl

Methods

showsPrec :: Int -> Lvl ctx -> ShowS #

show :: Lvl ctx -> String #

showList :: [Lvl ctx] -> ShowS #

Eq (Lvl ctx) Source # 
Instance details

Defined in DeBruijn.Lvl

Methods

(==) :: Lvl ctx -> Lvl ctx -> Bool #

(/=) :: Lvl ctx -> Lvl ctx -> Bool #

Ord (Lvl ctx) Source # 
Instance details

Defined in DeBruijn.Lvl

Methods

compare :: Lvl ctx -> Lvl ctx -> Ordering #

(<) :: Lvl ctx -> Lvl ctx -> Bool #

(<=) :: Lvl ctx -> Lvl ctx -> Bool #

(>) :: Lvl ctx -> Lvl ctx -> Bool #

(>=) :: Lvl ctx -> Lvl ctx -> Bool #

max :: Lvl ctx -> Lvl ctx -> Lvl ctx #

min :: Lvl ctx -> Lvl ctx -> Lvl ctx #

lvlToIdx :: Size ctx -> Lvl ctx -> Idx ctx Source #

Convert level to index.

>>> lvlToIdx S2 (lvlZ S1)
0

lvlZ :: Size ctx -> Lvl (S ctx) Source #

Last level.

>>> lvlZ S1
1
>>> lvlZ S5
5

sinkLvl :: Lvl ctx -> Lvl (S ctx) Source #

Sink Lvl into a larger context.

>>> sinkLvl (lvlZ S3)
3
>>> sink (lvlZ S3)
3
>>> mapLvl (LS LZ) (lvlZ S3)
3

class Sinkable t where Source #

Sinkable terms can be weakened (sunk) cheaply. (when Lvl is implemented as newtype over Int).

Methods

mapLvl :: Lte ctx ctx' -> t ctx -> t ctx' Source #

Instances

Instances details
Sinkable Lvl Source # 
Instance details

Defined in DeBruijn.Lvl

Methods

mapLvl :: forall (ctx :: Ctx) (ctx' :: Ctx). Lte ctx ctx' -> Lvl ctx -> Lvl ctx' Source #

sink :: Sinkable t => t ctx -> t (S ctx) Source #

mapSink :: (Functor f, Sinkable t) => f (t ctx) -> f (t (S ctx)) Source #

sinkSize :: Sinkable t => Size ctx -> t EmptyCtx -> t ctx Source #

mapSinkSize :: (Functor f, Sinkable t) => Size ctx -> f (t EmptyCtx) -> f (t ctx) Source #

sinkAdd :: Sinkable t => Add n ctx ctx' -> t ctx -> t ctx' Source #

mapSinkAdd :: (Functor f, Sinkable t) => Add n ctx ctx' -> f (t ctx) -> f (t ctx') Source #