digit-0.1.2: A data-type representing digits 0-9 and other combinations

Safe HaskellNone
LanguageHaskell2010

Data.Digit.Digit1_9

Contents

Description

A data type with nine nullary constructors [1-9] and combinators.

Synopsis

Data type

Destructors

foldDigit1_9 Source

Arguments

:: a

One.

-> a

Two.

-> a

Three.

-> a

Four.

-> a

Five.

-> a

Six.

-> a

Seven.

-> a

Eight.

-> a

Nine.

-> Digit1_9

The digit to fold.

-> a 

Catamorphism for Digit1_9.

foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d1 == x1
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d2 == x2
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d3 == x3
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d4 == x4
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d5 == x5
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d6 == x6
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d7 == x7
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d8 == x8
foldDigit1_9 x1 x2 x3 x4 x5 x6 x7 x8 x9 d9 == x9

Prisms

digit1_9 :: Prism' Int Digit1_9 Source

A prism for using Int as Digit1_9.

>>> 5 ^? digit1_9
Just 5
>>> 0 ^? digit1_9
Nothing
>>> 9 ^? digit1_9
Just 9
>>> 10 ^? digit1_9
Nothing
>>> (-5) ^? digit1_9
Nothing

digitC1_9 :: Prism' Char Digit1_9 Source

A prism for using Char as Digit1_9.

>>> '5' ^? digitC1_9
Just 5
>>> '0' ^? digitC1_9
Nothing
>>> '9' ^? digitC1_9
Just 9
>>> 'x' ^? digitC1_9
Nothing
>>> '*' ^? digitC1_9
Nothing

digit1_9digit :: Prism' Digit Digit1_9 Source

A prism for using Digit as Digit1_9.

>>> d5 ^? digit1_9digit
Just 5
>>> d0 ^? digit1_9digit
Nothing
>>> d9 ^? digit1_9digit
Just 9
>>> d1 ^? digit1_9digit
Just 1