Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
de Bruijn indices for well-scoped terms.
Synopsis
- data Idx n where
- absurdIdx :: Idx EmptyCtx -> a
- unIdx :: a -> (Idx n -> a) -> Idx (S n) -> a
- idxToInt :: Idx n -> Int
- pattern I1 :: () => m ~ S (S n) => Idx m
- pattern I2 :: () => m ~ S (S (S n)) => Idx m
- pattern I3 :: () => m ~ S (S (S (S n))) => Idx m
- pattern I4 :: () => m ~ S (S (S (S (S n)))) => Idx m
- pattern I5 :: () => m ~ S (S (S (S (S (S n))))) => Idx m
- pattern I6 :: () => m ~ S (S (S (S (S (S (S n)))))) => Idx m
- pattern I7 :: () => m ~ S (S (S (S (S (S (S (S n))))))) => Idx m
- pattern I8 :: () => m ~ S (S (S (S (S (S (S (S (S n)))))))) => Idx m
- pattern I9 :: () => m ~ S (S (S (S (S (S (S (S (S (S n))))))))) => Idx m
de Bruijn indices
de Bruijn indices.
>>>
IS (IS (IS IZ))
3
absurdIdx :: Idx EmptyCtx -> a Source #
Derive anything from index into empty scope.
Note: don't use EmptyCase
as it doesn't work for unsafe representation.