| Copyright | Copyright (c) 2016 the Hakaru team |
|---|---|
| License | BSD3 |
| Maintainer | wren@community.haskell.org |
| Stability | experimental |
| Portability | Haskell98 + CPP |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.Number.Nat
Description
A data type for natural numbers (aka non-negative integers).
Documentation
Natural numbers, with fixed-width à la Int. N.B., the Num
instance will throw errors on subtraction, negation, and
fromInteger when the result is not a natural number.
toNat :: Int -> Maybe Nat Source #
Safely convert an integer to a natural number. Returns Nothing
if the integer is negative.