MIT licensed by Chris Martin
Maintained by Chris Martin, Julie Moronuki
This version can be pinned in stack with:d10-1.0.1.2@sha256:57d8be302a14217c484c2f7751dc83c1116e15eb5e5e7d41e16694a8d469feab,2682

Data types representing the digits zero through nine.

Modules

Each of the following modules defines a different type named D10, all of which are different representations of the same concept:

  • D10.Char - Defines a D10 type as a newtype for Char, where the values are restricted to characters between '0' and '9'.

  • D10.Num - Defines a D10 type as a newtype for any type with an instance of the Num class, where the values are restricted to numbers between fromInteger 0 and fromInteger 9.

  • D10.Safe - Defines a D10 type as D0 | D1 | D2 | ... | D9.

The Arithmetic modules provide infix operators (+), (-), (*) for modular arithmetic:

  • D10.Char.Arithmetic
  • D10.Num.Arithmetic
  • D10.Safe.Arithmetic

The following modules export constructors that can be used incorrectly:

  • D10.Char.Unsafe
  • D10.Num.Unsafe

Functions to test whether values of various types represent digits in the range 0 to 9:

  • D10.Predicate

Quasi-quoters

Each module that defines a D10 type also defines quasi-quoters for it. With the QuasiQuotes GHC extension enabled, a single digit like 7 can be written as [d10|7|], and a list of digits like [4,5,6] can be written as [d10|456|]. For D10.Char and D10.Num, the quasi-quoters are an important feature, because the D10 types defined in these modules have unsafe constructors, and the quasi-quoters provide compile-time assurance that we never construct a D10 that represents a value outside the range 0 to 9.

Changes

1.0.1.2 (2023-01-02)

Rename internal library to work around haddock issue

1.0.1.1 (2023-01-02)

Support GHC 9.4

1.0.1.0 (2022-03-22)

Start of changelog