Safe Haskell | None |
---|---|
Language | GHC2021 |
Data.DeBruijn.Index.Fast
Synopsis
- data Ix (n :: Nat) where
- eqIx :: forall (n :: Nat) (m :: Nat). Ix n -> Ix m -> Bool
- fromIx :: forall i (n :: Nat). Integral i => Ix n -> i
- fromIxRaw :: forall (n :: Nat). Ix n -> IxRep
- isPos :: forall (n :: Nat) a. Ix n -> (Pos n => a) -> a
- thin :: forall (n :: Nat). Ix ('S n) -> Ix n -> Ix ('S n)
- thick :: forall (n :: Nat). Ix ('S n) -> Ix ('S n) -> Maybe (Ix n)
- inject :: forall (n :: Nat) (m :: Nat). Ix n -> SNat m -> Ix (n + m)
- raise :: forall (n :: Nat) (m :: Nat). SNat n -> Ix m -> Ix (n + m)
- data SomeIx = SomeIx {}
- withSomeIx :: (forall (n :: Nat). SNat n -> Ix n -> a) -> SomeIx -> a
- toSomeIx :: (Integral n, Integral i) => (n, i) -> SomeIx
- toSomeIxRaw :: (SNatRep, IxRep) -> SomeIx
- fromSomeIx :: (Integral n, Integral i) => SomeIx -> (n, i)
- fromSomeIxRaw :: SomeIx -> (SNatRep, IxRep)
- type IxRep = Int
- intToIxRep :: Int -> IxRep
- ixRepToInt :: IxRep -> Int
- snatRepToIxRep :: SNatRep -> IxRep
- ixRepToSNatRep :: IxRep -> SNatRep
- newtype Ix (n :: Nat) = UnsafeIx {}
DeBruijn Indexes
data Ix (n :: Nat) where Source #
is the type of DeBruijn indices less than Ix
nn
.
fromIx :: forall i (n :: Nat). Integral i => Ix n -> i Source #
returns the numeric representation of 'SNat n'.fromSNat
n
fromIxRaw :: forall (n :: Nat). Ix n -> IxRep Source #
returns the raw numeric representation of 'SNat n'.fromIxRaw
n
isPos :: forall (n :: Nat) a. Ix n -> (Pos n => a) -> a Source #
If any value of type
exists, Ix
nn
must have a predecessor.
Existential Wrapper
An existential wrapper around indexes.
toSomeIxRaw :: (SNatRep, IxRep) -> SomeIx Source #
constructs the index toSomeIxRaw
nn
at type
from the Ix
nInt
n
.
toSomeIxRaw (fromSomeIxRaw i) == i
fromSomeIx :: (Integral n, Integral i) => SomeIx -> (n, i) Source #
returns the numeric representation of the wrapped index.fromSomeSNat
n
fromSomeIxRaw :: SomeIx -> (SNatRep, IxRep) Source #
returns the fromSomeSNat
nInt
representation of the wrapped index.