type-level-numbers

Type level numbers implemented using type families.

Version on this page:0.1.1.1
LTS Haskell 22.14:0.1.1.2
Stackage Nightly 2024-03-28:0.1.1.2
Latest on Hackage:0.1.1.2

See all snapshots type-level-numbers appears in

BSD-3-Clause licensed and maintained by Alexey Khudyakov
This version can be pinned in stack with:type-level-numbers-0.1.1.1@sha256:40b58b311b27004efa6cd851e401b507ccf31d0a04b215740e726d0691c174b8,2290

Module documentation for 0.1.1.1

  • TypeLevel
    • TypeLevel.Boolean
    • TypeLevel.Number
      • TypeLevel.Number.Classes
      • TypeLevel.Number.Int
      • TypeLevel.Number.Nat
        • TypeLevel.Number.Nat.Num
    • TypeLevel.Reify

This is type level numbers implemented using type families. Natural numbers use binary encoding. With default context stack numbers up to 2^18-1 coudl be represented. Signed integer numbers use balanced ternary encoding.

Package is structured as folows:

  • [TypeLevel.Number.Classes] contain generic type families such as Add

  • [TypeLevel.Number.Nat] natural numbers implemented using binary encoding

  • [TypeLevel.Number.Int] signed integers implemented using balanced ternary encoding

  • [TypeLevel.Boolean] type level booleans

So far comparison of numbers, subtraction and multiplication of numbers are supported.