Num -package:haha

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)
  • Coherence with toInteger if the type also implements Integral, then fromInteger is a left inverse for toInteger, i.e. fromInteger (toInteger i) == i
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.
The Num class and the Integer type.
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.
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)
  • Coherence with toInteger if the type also implements Integral, then fromInteger is a left inverse for toInteger, i.e. fromInteger (toInteger i) == i
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.
Numeric instances for Convertible. Copyright (C) 2009-2011 John Goerzen jgoerzen@complete.org All rights reserved. For license and copyright information, see the file LICENSE These instances perform conversion between numeric types such as Double, Int, Integer, Rational, and the like. Here are some notes about the conversion process: Conversions from floating-point types such as Double to integral types are done via the truncate function. This is a somewhat arbitrary decision; if you need different behavior, you will have to write your own instance or manually perform the conversion. All conversions perform bounds checking. If a value is too large for its destination type, you will get a ConvertError informing you of this. Note that this behavior differs from functions in the Haskell standard libraries, which will perform the conversion without error, but give you garbage in the end. Conversions do not perform precision checking; loss of precision is implied with certain conversions (for instance, Double to Float) and this is not an error.
Basic numeric class.
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.
Number instances for MSFs that produce numbers. This allows you to use numeric operators with MSFs that output numbers, for example, you can write:
msf1 :: MSF Input Double -- defined however you want
msf2 :: MSF Input Double -- defined however you want
msf3 :: MSF Input Double
msf3 = msf1 + msf2
instead of
msf3 = (msf1 &&& msf2) >>> arr (uncurry (+))
Instances are provided for the type classes Num, Fractional and Floating.
x * 2 ^ y
Simple coordinate in current user coordinate.
Parse an integral number number.
Odds and ends, mostly functions for reading and showing RealFloat-like kind of values.