@hackage numerals0.4

Convert numbers to number words

Convert numbers to number words in a number of languages. Each language has its own module. The module name is based on one of the ISO 639 Alpha codes. Each module contains one or more cardinal and ordinal functions and a struct function. The cardinal functions directly convert cardinal numbers to a string-like representation of their spoken form. The ordinal functions do the same but for ordinal numbers. The struct functions convert numbers to a polymorphic representation of their grammatical structure.

The use of this package is best understood with some examples. First some English number names, both British and US variants:

>>>>>>>>>

French, which contains some traces of a base 20 system:

>>>>>>

Conversions can fail. Alamblak, a language spoken by a few people in Papua New Guinea, has no representation for negative numbers:

>>>>>>

Some languages have multiple scripts and methods for writing number names. Take Chinese for example, which can be written using Han characters or transcribed to the Latin script using Pinyin.

Traditional Chinese characters:

>>>>>>

Simplified characters for use in financial contexts:

>>>

Transcribed using Pinyin:

>>>

Using the struct functions you can see the grammatical structure of number names. Because the results of these functions are polymorphic you need to specify a specific type.

>>>>>>>>>>>>

Compare with:

>>>

100 (honderd) + (3 (drie) + (ën) 2 (twin) * 10 (tig))