| Copyright | (C) 2013-2016, University of Twente |
|---|---|
| License | BSD2 (see the file LICENSE) |
| Maintainer | Christiaan Baaij <christiaan.baaij@gmail.com> |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
| Extensions |
|
CLaSH.Promoted.Nat
Description
- data SNat n = KnownNat n => SNat (Proxy n)
- snat :: KnownNat n => SNat n
- withSNat :: KnownNat n => (SNat n -> a) -> a
- snatToInteger :: SNat n -> Integer
- addSNat :: SNat a -> SNat b -> SNat (a + b)
- subSNat :: SNat a -> SNat b -> SNat (a - b)
- mulSNat :: SNat a -> SNat b -> SNat (a * b)
- powSNat :: SNat a -> SNat b -> SNat (a ^ b)
- data UNat :: Nat -> * where
- toUNat :: SNat n -> UNat n
- addUNat :: UNat n -> UNat m -> UNat (n + m)
- multUNat :: UNat n -> UNat m -> UNat (n * m)
- powUNat :: UNat n -> UNat m -> UNat (n ^ m)
Documentation
Singleton value for a type-level natural number n
- CLaSH.Promoted.Nat.Literals contains a list of predefined
SNatliterals - CLaSH.Promoted.Nat.TH has functions to easily create large ranges of new
SNatliterals
withSNat :: KnownNat n => (SNat n -> a) -> a Source
Supply a function with a singleton natural n according to the context
snatToInteger :: SNat n -> Integer Source
toUNat :: SNat n -> UNat n Source
Convert a singleton natural number to its unary representation
NB: Not synthesisable
addUNat :: UNat n -> UNat m -> UNat (n + m) Source
Add two unary singleton natural numbers
NB: Not synthesisable