| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Digit.Digit
Contents
Description
A data type with ten nullary constructors [0-9] and combinators.
Data type
A data type with ten nullary constructors.
Destructors
Arguments
| :: a | Zero. |
| -> a | One. |
| -> a | Two. |
| -> a | Three. |
| -> a | Four. |
| -> a | Five. |
| -> a | Six. |
| -> a | Seven. |
| -> a | Eight. |
| -> a | Nine. |
| -> Digit | The digit to fold. |
| -> a |
Catamorphism for Digit.
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d0 == x0
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d1 == x1
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d2 == x2
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d3 == x3
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d4 == x4
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d5 == x5
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d6 == x6
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d7 == x7
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d8 == x8
foldDigit x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 d9 == x9
Prisms
digit :: Prism' Int Digit Source
A prism for using Int as Digit.
>>>5 ^? digitJust 5
>>>0 ^? digitJust 0
>>>9 ^? digitJust 9
>>>10 ^? digitNothing
>>>(-5) ^? digitNothing
digitC :: Prism' Char Digit Source
A prism for using Char as Digit.
>>>'5' ^? digitCJust 5
>>>'0' ^? digitCJust 0
>>>'9' ^? digitCJust 9
>>>'a' ^? digitCNothing
>>>'@' ^? digitCNothing
A QuasiQuoter for any range of Digit.
- digitQ|4|
- :: Digit 4
named [digitQ|4|] = "four" named [digitQ|$x|] = "not four, " ++ show x ++ " instead"
mod10D x = let y = mod x 10 in [digitQ|$y|]