| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
CheckedLiterals.Class.Rational.TypeNats
Description
Small type-level helpers used by rational literal checks.
Synopsis
- type family IsPowerOfTwo (n :: Nat) :: Bool where ...
Documentation
type family IsPowerOfTwo (n :: Nat) :: Bool where ... Source #
Type-level predicate that checks whether a natural is a power of two.
Equations
| IsPowerOfTwo 0 = 'False | |
| IsPowerOfTwo 1 = 'True | |
| IsPowerOfTwo n = If (Mod n 2 <=? 0) (IsPowerOfTwo (Div n 2)) 'False |