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.

Instances

 Bounded Digit Enum Digit Eq Digit Ord Digit Read Digit Show Digit Arbitrary Digit

Zero.

One.

Two.

Three.

Four.

Five.

Six.

Seven.

Eight

Nine.

# Decisions

Returns whether or not the digit is 0.

Returns whether or not the digit is 1.

Returns whether or not the digit is 2.

Returns whether or not the digit is 3.

Returns whether or not the digit is 4.

Returns whether or not the digit is 5.

Returns whether or not the digit is 6.

Returns whether or not the digit is 7.

Returns whether or not the digit is 8.

Returns whether or not the digit is 9.

# Deconstructors

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.