Changes between Version 7 and Version 8 of StandardClasses
 Timestamp:
 Sep 14, 2006 9:24:47 AM (11 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

StandardClasses
v7 v8 4 4 This page collects issues and proposals for the standard classes. 5 5 Many of the proposals involve additional superclasses, which would be less burdensome with [ticket:101 class aliases] or something similar, but such features are not yet implemented. 6 7 == References == 8 9 * [http://www.haskell.org/onlinereport/basic.html#sect6.3 Standard Haskell Classes] of Haskell 98 10 * [http://www.haskell.org/onlinereport/standardprelude.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/062006/html/report.html#numericprelude Numeric prelude project] 6 14 7 15 == Constructor classes == … … 29 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). 30 38 Clients of the classes would notice only some more general types. 31 See also:32 * [http://haskell.org/docon/ DoCon the Algebraic Domain Constructor]33 * [http://haskell.org/communities/062006/html/report.html#numericprelude Numeric prelude project]34 39 35 40 === The Num class === … … 40 45 41 46 Proposals: 42 * a grouplike class with `zero`, `(+)` and `negate`/`()`43 (could be further split with a monoid subclass)44 * aringlike subclass adding `(*)` and `one`/`fromInteger`, with the existing `Num` class as a further subclass.47 * A grouplike class with `zero`, `(+)` and `negate`/`()`. 48 * (Could be further split with a monoid subclass.) 49 * A ringlike subclass adding `(*)` and `one`/`fromInteger`, with the existing `Num` class as a further subclass. 45 50 Note that the `Float` and `Double` instances will not satisfy the usual axioms for these structures. 51 52 === The Fractional class === 53 Issues: 54 * `(/)`, `recip` and `fromRational` can be lifted to functions, but many of the prerequisites can't be defined for these. 55 56 Proposals: 57 * Add a division ringlike superclass adding these operations to the ringlike class. 58 (A division ring has the same operations as a field, but does not assume commutative multiplication, allowing structures such as quaternions.) 59 * (Could be further split with a semiring subclass.) 60 * Add default 61 {{{ 62 fromRational x = fromInteger (numerator x) / fromInteger (denominator x) 63 }}} 64 This is independent of all the other proposals. 46 65 47 66 === The Integral class === … … 50 69 `Ord`, `Num(abs, signum)` and `toRational` don't make sense for polynomials and Gaussian integers. 51 70 `quot` and `rem` assume an ordering. 52 53 === The Fractional class ===54 Issues:55 * `(/)`, `recip` and `fromRational` can be lifted to functions, but many of the prerequisites can't be defined for these.56 57 Proposals:58 * Add a fieldlike superclass adding these operations to the ringlike class.59 * Add default60 {{{61 fromRational x = fromInteger (numerator x) / fromInteger (denominator x)62 }}}63 This is independent of all the other proposals.64 71 65 72 == Other standard classes ==