natural-numbers-0.1.0.2: Natural numbers

Safe HaskellSafe-Infered

Data.Natural

Description

Provides a type for natural numbers.

Synopsis

Documentation

data Natural Source

The type of natural numbers.

Note that matching a natural number against a negative pattern might not work as you expect. For example, evaluating the following expression results in a run-time error, instead of the result "plus five":

case 5 :: Natural of
    -5 -> "minus five"
     5 -> "plus five"

The reason is that the == operator of Natural is used for checking if the patterns match, making it necessary to convert -5 to Natural.