Num package:rio

Basic numeric class. The Haskell Report defines no laws for Num. However, (+) and (*) are customarily expected to define a ring and have the following properties:
  • Associativity of (+) (x + y) + z = x + (y + z)
  • Commutativity of (+) x + y = y + x
  • fromInteger 0 is the additive identity x + fromInteger 0 = x
  • negate gives the additive inverse x + negate x = fromInteger 0
  • Associativity of (*) (x * y) * z = x * (y * z)
  • fromInteger 1 is the multiplicative identity x * fromInteger 1 = x and fromInteger 1 * x = x
  • Distributivity of (*) with respect to (+) a * (b + c) = (a * b) + (a * c) and (b + c) * a = (b * a) + (c * a)
Note that it isn't customarily expected that a type instance of both Num and Ord implement an ordered ring. Indeed, in base only Integer and Rational do.
Nd: Number, Decimal
Nl: Number, Letter
No: Number, Other
Selects alphabetic or numeric Unicode characters. Note that numeric digits outside the ASCII range, as well as numeric characters which aren't digits, are selected by this function but not by isDigit. Such characters may be part of identifiers but are not used by the printer and reader to represent numbers.
Selects Unicode numeric characters, including digits from various scripts, Roman numerals, et cetera. This function returns True if its argument has one of the following GeneralCategorys, or False otherwise: These classes are defined in the Unicode Character Database, part of the Unicode standard. The same document defines what is and is not a "Number".

Examples

Basic usage:
>>> isNumber 'a'
False

>>> isNumber '%'
False

>>> isNumber '3'
True
ASCII '0' through '9' are all numbers:
>>> and $ map isNumber ['0'..'9']
True
Unicode Roman numerals are "numbers" as well:
>>> isNumber 'Ⅸ'
True
Convert from an Int.
Convert to an Int. It is implementation-dependent what fromEnum returns when applied to a value that is too large to fit in an Int.
Sign of a number. The functions abs and signum should satisfy the law:
abs x * signum x == x
For real numbers, the signum is either -1 (negative), 0 (zero) or 1 (positive).
Class Enum defines operations on sequentially ordered types. The enumFrom... methods are used in Haskell's translation of arithmetic sequences. Instances of Enum may be derived for any enumeration type (types whose constructors have no fields). The nullary constructors are assumed to be numbered left-to-right by fromEnum from 0 through n-1. See Chapter 10 of the Haskell Report for more details. For any type that is an instance of class Bounded as well as Enum, the following should hold:
enumFrom     x   = enumFromTo     x maxBound
enumFromThen x y = enumFromThenTo x y bound
where
bound | fromEnum y >= fromEnum x = maxBound
| otherwise                = minBound
O(n) Yield a vector of the given length containing the values x, x+1 etc. This operation is usually more efficient than enumFromTo.
enumFromN 5 3 = <5,6,7>
O(n) Yield a vector of the given length containing the values x, x+y, x+y+y etc. This operations is usually more efficient than enumFromThenTo.
enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
O(n) Enumerate values from x to y with a specific step z. WARNING: This operation can be very inefficient. If at all possible, use enumFromStepN instead.
O(n) Enumerate values from x to y. WARNING: This operation can be very inefficient. If at all possible, use enumFromN instead.
O(n) Yield a vector of the given length containing the values x, x+1 etc. This operation is usually more efficient than enumFromTo.
enumFromN 5 3 = <5,6,7>
O(n) Yield a vector of the given length containing the values x, x+y, x+y+y etc. This operations is usually more efficient than enumFromThenTo.
enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
O(n) Enumerate values from x to y with a specific step z. WARNING: This operation can be very inefficient. If at all possible, use enumFromStepN instead.
O(n) Enumerate values from x to y. WARNING: This operation can be very inefficient. If at all possible, use enumFromN instead.
O(n) Yield a vector of the given length containing the values x, x+1 etc. This operation is usually more efficient than enumFromTo.
enumFromN 5 3 = <5,6,7>
O(n) Yield a vector of the given length containing the values x, x+y, x+y+y etc. This operations is usually more efficient than enumFromThenTo.
enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
O(n) Enumerate values from x to y with a specific step z. WARNING: This operation can be very inefficient. If at all possible, use enumFromStepN instead.
O(n) Enumerate values from x to y. WARNING: This operation can be very inefficient. If at all possible, use enumFromN instead.
O(n) Yield a vector of the given length containing the values x, x+1 etc. This operation is usually more efficient than enumFromTo.
enumFromN 5 3 = <5,6,7>
O(n) Yield a vector of the given length containing the values x, x+y, x+y+y etc. This operations is usually more efficient than enumFromThenTo.
enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
O(n) Enumerate values from x to y with a specific step z. WARNING: This operation can be very inefficient. If at all possible, use enumFromStepN instead.