witness-0.7: values that witness types
Safe HaskellNone
LanguageGHC2021

Data.PeanoNat

Synopsis

Documentation

data PeanoNat Source #

Inductive natural numbers.

Constructors

Zero 
Succ PeanoNat 

Instances

Instances details
TestEquality PeanoNatType Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

Methods

testEquality :: forall (a :: PeanoNat) (b :: PeanoNat). PeanoNatType a -> PeanoNatType b -> Maybe (a :~: b) #

TestOrder PeanoNatType Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

Methods

testCompare :: forall (a :: PeanoNat) (b :: PeanoNat). PeanoNatType a -> PeanoNatType b -> WOrdering a b Source #

Representative PeanoNatType Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

WitnessValue PeanoNatType Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

Is PeanoNatType 'Zero Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

Is PeanoNatType n => Is PeanoNatType ('Succ n :: PeanoNat) Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

type WitnessValueType PeanoNatType Source # 
Instance details

Defined in Data.Type.Witness.Specific.PeanoNat

type family Add (a :: PeanoNat) (b :: PeanoNat) :: PeanoNat where ... Source #

Equations

Add 'Zero b = b 
Add ('Succ a) b = 'Succ (Add a b) 

subtractFromPeanoNat :: PeanoNat -> PeanoNat -> Maybe PeanoNat Source #

subtractFromPeanoNat a b = b - a

type family PeanoToNatural (pn :: PeanoNat) :: Nat where ... Source #

Equations

PeanoToNatural 'Zero = 0 
PeanoToNatural ('Succ pn) = PeanoToNatural pn + 1 

type family ListLength (l :: [k]) :: PeanoNat where ... Source #

Equations

ListLength ('[] :: [k]) = 'Zero 
ListLength (_1 ': aa :: [k]) = 'Succ (ListLength aa)