Portability | non-portable (type families, requires ghc >= 6.9) |
---|---|
Stability | experimental |
Maintainer | pgavin@gmail.com |
Safe Haskell | None |
Type-level numerical operations using type families.
- data ds :. d
- type family Neg x
- negT :: x -> Neg x
- type family IsPositive x
- isPositiveT :: x -> IsPositive x
- type family IsZero x
- isZeroT :: x -> IsZero x
- type family IsNegative x
- isNegativeT :: x -> IsNegative x
- type family IsNatural x
- isNaturalT :: x -> IsNatural x
- type family Succ x
- succT :: x -> Succ x
- type family Pred x
- predT :: x -> Pred x
- type family IsEven x
- isEvenT :: x -> IsEven x
- type family IsOdd x
- isOddT :: x -> IsOdd x
- type family x :+: y
- addT :: x -> y -> x :+: y
- type family x :-: y
- subT :: x -> y -> x :-: y
- type family x :*: y
- mulT :: x -> y -> x :*: y
- type family Mul2 x
- mul2T :: x -> Mul2 x
- type family Pow2 x
- pow2T :: x -> Pow2 x
- type family Log2Ceil x
- log2CeilT :: x -> Log2Ceil x
- type family DivMod x y
- divModT :: x -> y -> DivMod x y
- type family Div x y
- divT :: x -> y -> Div x y
- type family Mod x y
- modT :: x -> y -> Mod x y
- type family Div2 x
- div2T :: x -> Div2 x
- type family Fac x
- facT :: x -> Fac x
- class IntegerR r where
- reifyIntegral :: r -> Integer -> (forall s. (IntegerT s, Repr s ~ r) => s -> a) -> a
- class IntegerR (Repr x) => IntegerT x where
- type Repr x
- fromIntegerT :: Num y => x -> y
- class IntegerT x => NaturalT x
- class IntegerT x => PositiveT x
- class IntegerT x => NegativeT x
- reifyPositive :: IntegerR r => r -> Integer -> (forall s. (PositiveT s, Repr s ~ r) => s -> a) -> Maybe a
- reifyNegative :: IntegerR r => r -> Integer -> (forall s. (NegativeT s, Repr s ~ r) => s -> a) -> Maybe a
- reifyNatural :: IntegerR r => r -> Integer -> (forall s. (NaturalT s, Repr s ~ r) => s -> a) -> Maybe a
Documentation
type family IsPositive x Source
isPositiveT :: x -> IsPositive xSource
type family IsNegative x Source
isNegativeT :: x -> IsNegative xSource
isNaturalT :: x -> IsNatural xSource
reifyIntegral :: r -> Integer -> (forall s. (IntegerT s, Repr s ~ r) => s -> a) -> aSource
reifyPositive :: IntegerR r => r -> Integer -> (forall s. (PositiveT s, Repr s ~ r) => s -> a) -> Maybe aSource