| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Data.PeanoNat
Synopsis
- data PeanoNat
- addPeanoNat :: PeanoNat -> PeanoNat -> PeanoNat
- type family Add (a :: PeanoNat) (b :: PeanoNat) :: PeanoNat where ...
- subtractFromPeanoNat :: PeanoNat -> PeanoNat -> Maybe PeanoNat
- multiplyPeanoNat :: PeanoNat -> PeanoNat -> PeanoNat
- peanoToNatural :: PeanoNat -> Natural
- naturalToPeano :: Natural -> PeanoNat
- type family PeanoToNatural (pn :: PeanoNat) :: Nat where ...
- type family ListLength (l :: [k]) :: PeanoNat where ...
Documentation
Inductive natural numbers.
Instances
subtractFromPeanoNat :: PeanoNat -> PeanoNat -> Maybe PeanoNat Source #
subtractFromPeanoNat a b = b - a
peanoToNatural :: PeanoNat -> Natural Source #
naturalToPeano :: Natural -> PeanoNat Source #
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) |