Digit-0.0.3: A data-type representing digits 0-9

Data.Digit

Contents

Description

A data type with ten nullary constructors and combinators.

Synopsis

Data type

data Digit Source

A data type with ten nullary constructors.

Constructors

d0 :: DigitSource

Zero.

d1 :: DigitSource

One.

d2 :: DigitSource

Two.

d3 :: DigitSource

Three.

d4 :: DigitSource

Four.

d5 :: DigitSource

Five.

d6 :: DigitSource

Six.

d7 :: DigitSource

Seven.

d8 :: DigitSource

Eight

d9 :: DigitSource

Nine.

Decisions

is0 :: Digit -> BoolSource

Returns whether or not the digit is 0.

is1 :: Digit -> BoolSource

Returns whether or not the digit is 1.

is2 :: Digit -> BoolSource

Returns whether or not the digit is 2.

is3 :: Digit -> BoolSource

Returns whether or not the digit is 3.

is4 :: Digit -> BoolSource

Returns whether or not the digit is 4.

is5 :: Digit -> BoolSource

Returns whether or not the digit is 5.

is6 :: Digit -> BoolSource

Returns whether or not the digit is 6.

is7 :: Digit -> BoolSource

Returns whether or not the digit is 7.

is8 :: Digit -> BoolSource

Returns whether or not the digit is 8.

is9 :: Digit -> BoolSource

Returns whether or not the digit is 9.

Deconstructors

foldDigitSource

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.

if0 :: x -> x -> Digit -> xSource

Return the first argument if zero, otherwise the second argument.

if1 :: x -> x -> Digit -> xSource

Return the first argument if one, otherwise the second argument.

if2 :: x -> x -> Digit -> xSource

Return the first argument if two, otherwise the second argument.

if3 :: x -> x -> Digit -> xSource

Return the first argument if three, otherwise the second argument.

if4 :: x -> x -> Digit -> xSource

Return the first argument if four, otherwise the second argument.

if5 :: x -> x -> Digit -> xSource

Return the first argument if five, otherwise the second argument.

if6 :: x -> x -> Digit -> xSource

Return the first argument if six, otherwise the second argument.

if7 :: x -> x -> Digit -> xSource

Return the first argument if seven, otherwise the second argument.

if8 :: x -> x -> Digit -> xSource

Return the first argument if eight, otherwise the second argument.

if9 :: x -> x -> Digit -> xSource

Return the first argument if nine, otherwise the second argument.

ifEven :: x -> x -> Digit -> xSource

Return the first argument if even, otherwise the second argument.

ifOdd :: x -> x -> Digit -> xSource

Return the first argument if odd, otherwise the second argument.