Module

Type.Data.Peano.Int.Definition

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

#Int Source

data Int

Represents a whole Number ℤ

Note: Pos Z and Neg Z both represent 0

#Pos Source

data Pos :: Nat -> Int

Represents a posivite number

Pos (Succ Z) ^= + 1

Instances

#Neg Source

data Neg :: Nat -> Int

Represents a negative number

Neg (Succ Z) ^= - 1

Instances

#IProxy Source

data IProxy (i :: Int)

Constructors

Instances

#IsInt Source

class IsInt (i :: Int)  where

Members

  • reflectInt :: forall proxy. proxy i -> Int

    reflect a type-level Int to a value-level Int

    reflectInt (Proxy  :: _ N10) = -10
    reflectInt (IProxy :: _ N10) = -10
    

Instances

#showInt Source

showInt :: forall proxy i. IsInt i => proxy i -> String

#SumInt Source

class SumInt (a :: Int) (b :: Int) (c :: Int) | a b -> c

Instances

#plus Source

plus :: forall proxy a b c. SumInt a b c => proxy a -> proxy b -> proxy c

#Inverse Source

class Inverse (a :: Int) (b :: Int) | a -> b, b -> a

Invert the sign of a value (except for 0, which always stays positive)

Inverse (Pos (Succ Z)) ~> Neg (Succ Z)
Inverse (Pos Z) ~> Pos Z

Instances

#ProductInt Source

class ProductInt (a :: Int) (b :: Int) (c :: Int) | a b -> c

Instances

#prod Source

prod :: forall proxy a b c. ProductInt a b c => proxy a -> proxy b -> proxy c

#IsZeroInt Source

class IsZeroInt (int :: Int) (isZero :: Boolean) | int -> isZero

Instances