Changes between Version 13 and Version 14 of StandardClasses


Ignore:
Timestamp:
Jun 19, 2007 11:22:16 PM (8 years ago)
Author:
ross@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • StandardClasses

    v13 v14  
    99 * [http://www.haskell.org/onlinereport/basic.html#sect6.3 Standard Haskell Classes] of Haskell 98 
    1010 * [http://www.haskell.org/onlinereport/standard-prelude.html Standard Prelude] of Haskell 98 
    11  * [http://en.wikipedia.org/wiki/Algebraic_structure Algebraic structures] in !WikiPedia 
    12  * [http://www.haskell.org/docon/ DoCon the Algebraic Domain Constructor] 
    13  * [http://www.haskell.org/communities/06-2006/html/report.html#numericprelude Numeric prelude project] 
    1411 
    1512== Constructor classes == 
     
    3431 
    3532== Numbers == 
    36 The Haskell 98 numeric classes are adequate for Haskell 98 numeric types, but other mathematical objects do not fit. 
    37 If the Haskell 98 classes were retained for backwards compatibility, but with a more refined class hierarchy, the change would impact mostly on those defining instances (and these are the people inconvenienced by the current system). 
    38 Clients of the classes would notice only some more general types. 
    3933 
    40 === The Num class === 
    41 Issues: 
    42  * `Eq` and `Show` don't make sense for functions under lifting. 
    43  * `(*)` doesn't make sense for vectors. 
    44  * `abs` and `signum` don't make sense for `Complex Integer` (Gaussian integers), vectors, matrices, etc. 
    45    In general, `abs` and `signum` make it hard to lift `Num` through type constructors. 
    46  
    47 Proposals: 
    48  * A group-like class with `zero`, `(+)` and `negate`/`(-)`. 
    49  * (Could be further split with a monoid sub-class.) 
    50  * A ring-like subclass adding `(*)` and `one`/`fromInteger`, with the existing `Num` class as a further subclass. 
    51  * (Could be further split with a semiring subclass, e.g. for [wiki:Natural natural numbers].) 
    52 Note that the `Float` and `Double` instances will not satisfy the usual axioms for these structures. 
    53  
    54 === The Real class === 
    55 Issues: 
    56  * The class assumes a mapping to `Rational`, but this cannot be defined for structures intermediate between the rationals and reals even though the operations of subclasses make sense for them, e.g. surds, computable reals. 
    57  
    58 === The Fractional class === 
    59 Issues: 
    60  * `(/)`, `recip` and `fromRational` can be lifted to functions, but many of the pre-requisites can't be defined for these. 
    61  
    62 Proposals: 
    63  * Add a division ring-like superclass adding these operations to the ring-like class. 
    64    (A division ring has the same operations as a field, but does not assume commutative multiplication, allowing structures such as quaternions.) 
    65  * Add default 
    66    {{{ 
    67 fromRational x = fromInteger (numerator x) / fromInteger (denominator x) 
    68 }}} 
    69    This is independent of all the other proposals. 
    70  
    71 === The Integral class === 
    72 Issues: 
    73  * `div` and `mod` also sense for rationals, polynomials and Gaussian integers, but `Enum` and `toInteger` do not. 
    74  * `Ord`, `Num(abs, signum)` and `toRational` don't make sense for polynomials and Gaussian integers. 
    75  * `quot` and `rem` assume an ordering. 
     34See NumericClasses. 
    7635 
    7736== Other standard classes ==