Num -package:mixed-types-num -package:distribution-opensuse -package:base is:module
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.
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.
Deprecated: This module will be removed in the next major
release.
Provides numerical data types and functions.
A wrapper that provides instances of Haskell 98 and NumericPrelude
numeric type classes for types that have NumericPrelude instances.
GtkNumericSorter is a
GtkSorter that compares
numbers.
To obtain the numbers to compare, this sorter evaluates a
Expression.
New users with are strongly encouraged to see if
Data.Text.ICU.NumberFormatter fits their use case. Although not
deprecated, this header is provided for backwards compatibility only.
Number formatter implemented as bindings to the International
Components for Unicode (ICU) libraries.
A generalized version of the class hirarchy for numbers. All functions
that would break a potential deep embedding are removed or generalized
to support deep embeddings.
The class hierarchy for numeric types keeps as close as possible to
the Prelude hierarchy. A great part of the default
implementation and comments are copied and adopted from
Prelude.
Literal support for Integral and Fractional
Compared to the Haskell hierarchy of number classes this provide a
more flexible approach that is closer to the mathematical foundation
(group, field, etc)
This try to only provide one feature per class, at the expense of the
number of classes.