Portability | unportable (GHC only) |
---|---|

Stability | unstable |

Maintainer | Alexey Khudyakov <alexey.skladnoy@gmail.com> |

Type level signed integer numbers are implemented using balanced ternary encoding much in the same way as natural numbers.

Currently following operations are supported: Next, Prev, Add, Sub, Mul.

# Integer numbers

Digit -1

Digit 0

Digit 1

Type class for type level integers. Only numbers without leading zeroes are members of the class.

IntT ZZ | |

IntT (D1 ZZ) | |

IntT (D1 n) => IntT (D1 (D1 n)) | |

IntT (D0 n) => IntT (D1 (D0 n)) | |

IntT (Dn n) => IntT (D1 (Dn n)) | |

IntT (D1 n) => IntT (D0 (D1 n)) | |

IntT (D0 n) => IntT (D0 (D0 n)) | |

IntT (Dn n) => IntT (D0 (Dn n)) | |

IntT (Dn ZZ) | |

IntT (D1 n) => IntT (Dn (D1 n)) | |

IntT (D0 n) => IntT (Dn (D0 n)) | |

IntT (Dn n) => IntT (Dn (Dn n)) |

# Template haskell utilities

module TypeLevel.Number.Classes