Safe Haskell | Safe-Inferred |
---|

- class Unknown α where
- class Lit α where
- class Neg α where
- neg :: α -> α

- class Add α where
- add :: α -> α -> α

- class Mul α where
- mul :: α -> α -> α

- class Sub α where
- sub :: α -> α -> α

- class Frac α where
- frac :: α -> α -> α

- class Scale α where
- class Dual α where
- dual :: α -> α

- class Plural α where
- plural :: α -> α

- class Inflection α where
- type Inf α
- inflection :: (Inf α -> Inf α) -> α -> α

# Documentation

An unknown value. This is used to signal that a value can not be represented in the expression language.

Law: isUnknown unknown == True

A literal value.

Example in English:

"three" = lit 3

Negation of a value.

Example in English:

"minus two" = neg (lit 2)

Addition of two values.

Example in English:

"fifteen" = lit 5 `add` lit 10

Multiplication of two values.

Example in English:

"thirty" = lit 3 `mul` lit 10

One value subtracted from another value.

Example in Latin:

"duodēvīgintī" = lit 2 `sub` (lit 2 `mul` lit 10)

A fraction.

Example in English:

"two thirds" = `frac` (lit 2) (lit 3)

A step in a scale of large values.

Should be interpreted as `10 ^ (rank * base + offset)`

.

Example in English:

"quadrillion" = scale 3 3 4

A dual of a value.

This is used in some languages that express some values as the dual of a smaller value. For instance, in Hebrew the number 20 is expressed as the dual of 10.

A plural of a value.

This is used in some languages that express some values as the plural of a smaller value. For instance, in Hebrew the numbers [30,40..90] are expressed as the plurals of [3..9].

class Inflection α whereSource

A change of inflection.

This is used in a language like Spanish where the inflection of a number word is not always constant. Specifically, in Spanish, large number names always have the masculine gender. So 'millón', 'billón' and the like are all masculine. This can result in the following number word: 10000001 = un (masculine) millón una (feminine)

inflection :: (Inf α -> Inf α) -> α -> αSource

Inflection (Exp i) | Precisely the |