Module
Type.Data.Peano.Nat.Definition
- Package
- purescript-typelevel-peano
- Repository
- csicar/purescript-typelevel-peano
#Succ Source
data Succ :: Nat -> Nat
Represents Successor of a Nat: (Succ a) ^= 1 + a
Instances
(IsNat a) => IsNat (Succ a)
(SumNat a b c) => SumNat (Succ a) b (Succ c)
ProductNat (Succ Z) a a
1 * a = a
(ProductNat a b ab, SumNat ab b result) => ProductNat (Succ a) b result
ExponentiationNat a Z (Succ Z)
(ExponentiationNat a b ab, ProductNat ab a result) => ExponentiationNat a (Succ b) result
(CompareNat a b ord) => CompareNat (Succ a) (Succ b) ord
IsZeroNat (Succ a) False
Pred (Succ a) a
#ProductNat Source
class ProductNat (a :: Nat) (b :: Nat) (c :: Nat) | a b -> c
a * b = c
Instances
ProductNat Z a Z
0 * a = 0
ProductNat (Succ Z) a a
1 * a = a
(ProductNat a b ab, SumNat ab b result) => ProductNat (Succ a) b result
#mulNat Source
mulNat :: forall proxy a b c. ProductNat a b c => proxy a -> proxy b -> proxy c
#ExponentiationNat Source
class ExponentiationNat (a :: Nat) (b :: Nat) (c :: Nat) | a b -> c
Instances
ExponentiationNat a Z (Succ Z)
(ExponentiationNat a b ab, ProductNat ab a result) => ExponentiationNat a (Succ b) result
#powNat Source
powNat :: forall proxy a b c. ExponentiationNat a b c => proxy a -> proxy b -> proxy c
> powNat d2 d3
8 -- : NProxy D8
a raised to the power of b a^b = c
#CompareNat Source
class CompareNat (a :: Nat) (b :: Nat) (ord :: Ordering) | a b -> ord
Instances
CompareNat a a EQ
CompareNat Z a LT
CompareNat a Z GT
(CompareNat a b ord) => CompareNat (Succ a) (Succ b) ord
0 * a = 0