d10: Digits 0-9

[ data, library, mit ] [ Propose Tags ]

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:

Other modules:

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 Data.D10.Char and Data.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. For Data.D10.Safe, the quasi-quoter is offered merely as a possible convenience, allowing you to write [d10|456789|] in place of the somewhat longer expression [D4,D5,D6,D7,D8,D9].


[Skip to Readme]
Versions 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.2.0.1, 0.2.1.0
Change log CHANGELOG.md
Dependencies base (>=4.10 && <4.13), template-haskell (>=2.12 && <2.15) [details]
License MIT
Copyright 2018 Typeclass Consulting, LLC
Author Chris Martin
Maintainer Chris Martin, Julie Moronuki
Category Data
Home page https://github.com/typeclasses/d10
Bug tracker https://github.com/typeclasses/d10/issues
Source repo head: git clone https://github.com/typeclasses/d10
Uploaded by chris_martin at Sun Oct 28 04:32:55 UTC 2018
Distributions NixOS:0.2.1.0
Downloads 172 total (33 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2018-10-28 [all 1 reports]
Hackage Matrix CI

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for d10-0.2.1.0

[back to package description]

d10

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:

  • Data.D10.Char - Defines a D10 type as a newtype for Char, where the values are restricted to characters between '0' and '9'.
  • Data.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.
  • Data.D10.Safe - Defines a D10 type as D0 | D1 | D2 | ... | D9.

Other modules:

  • Data.D10.Predicate - Functions to test whether values of various types represent digits in the range 0 to 9.

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 Data.D10.Char and Data.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. For Data.D10.Safe, the quasi-quoter is offered merely as a possible convenience, allowing you to write [d10|456789|] in place of the somewhat longer expression [D4,D5,D6,D7,D8,D9].