Module

Type.Data.Peano.Nat.Definition

Package
purescript-typelevel-peano
Repository
csicar/purescript-typelevel-peano

#Nat Source

data Nat

Represents a non-negative whole Number ℕ₀

#Z Source

data Z :: Nat

Represents 0

Instances

#Succ Source

data Succ :: Nat -> Nat

Represents Successor of a Nat: (Succ a) ^= 1 + a

Instances

#NProxy Source

data NProxy (n :: Nat)

Constructors

Instances

#IsNat Source

class IsNat (a :: Nat)  where

Members

  • reflectNat :: forall proxy. proxy a -> Int

    reflect typelevel Nat to a valuelevel Int

    reflectNat (Proxy  :: _ D10) = 10
    reflectNat (NProxy :: _ D10) = 10
    

Instances

#showNat Source

showNat :: forall proxy n. IsNat n => proxy n -> String

#SumNat Source

class SumNat (a :: Nat) (b :: Nat) (c :: Nat) | a b -> c

a + b = c

Instances

#plusNat Source

plusNat :: forall proxy a b c. SumNat a b c => proxy a -> proxy b -> proxy c

#ProductNat Source

class ProductNat (a :: Nat) (b :: Nat) (c :: Nat) | a b -> c

a * b = c

Instances

#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

#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

#IsZeroNat Source

class IsZeroNat (a :: Nat) (isZero :: Boolean) | a -> isZero

Instances

#Pred Source

class Pred (a :: Nat) (b :: Nat) | a -> b, b -> a

Instances

#pred Source

pred :: forall proxy a. (proxy (Succ a)) -> proxy a