| ... | ... | @@ -4,6 +4,14 @@ |
|
|
|
This page collects issues and proposals for the standard classes.
|
|
|
|
Many of the proposals involve additional superclasses, which would be less burdensome with [class aliases](https://gitlab.haskell.org//haskell/prime/issues/101) or something similar, but such features are not yet implemented.
|
|
|
|
|
|
|
|
## References
|
|
|
|
|
|
|
|
- [ Standard Haskell Classes](http://www.haskell.org/onlinereport/basic.html#sect6.3) of Haskell 98
|
|
|
|
- [ Standard Prelude](http://www.haskell.org/onlinereport/standard-prelude.html) of Haskell 98
|
|
|
|
- [ Algebraic structures](http://en.wikipedia.org/wiki/Algebraic_structure) in WikiPedia
|
|
|
|
- [ DoCon the Algebraic Domain Constructor](http://www.haskell.org/docon/)
|
|
|
|
- [ Numeric prelude project](http://www.haskell.org/communities/06-2006/html/report.html#numericprelude)
|
|
|
|
|
|
|
|
## Constructor classes
|
|
|
|
|
|
|
|
### The Functor class
|
| ... | ... | @@ -38,10 +46,6 @@ Proposals: |
|
|
|
The Haskell 98 numeric classes are adequate for Haskell 98 numeric types, but other mathematical objects do not fit.
|
|
|
|
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).
|
|
|
|
Clients of the classes would notice only some more general types.
|
|
|
|
See also:
|
|
|
|
|
|
|
|
- [ DoCon the Algebraic Domain Constructor](http://haskell.org/docon/)
|
|
|
|
- [ Numeric prelude project](http://haskell.org/communities/06-2006/html/report.html#numericprelude)
|
|
|
|
|
|
|
|
### The Num class
|
|
|
|
|
| ... | ... | @@ -55,22 +59,13 @@ Issues: |
|
|
|
|
|
|
|
Proposals:
|
|
|
|
|
|
|
|
- a group-like class with `zero`, `(+)` and `negate`/`(-)`
|
|
|
|
(could be further split with a monoid sub-class)
|
|
|
|
- a ring-like subclass adding `(*)` and `one`/`fromInteger`, with the existing `Num` class as a further subclass.
|
|
|
|
- A group-like class with `zero`, `(+)` and `negate`/`(-)`.
|
|
|
|
- (Could be further split with a monoid sub-class.)
|
|
|
|
- A ring-like subclass adding `(*)` and `one`/`fromInteger`, with the existing `Num` class as a further subclass.
|
|
|
|
|
|
|
|
|
|
|
|
Note that the `Float` and `Double` instances will not satisfy the usual axioms for these structures.
|
|
|
|
|
|
|
|
### The Integral class
|
|
|
|
|
|
|
|
|
|
|
|
Issues:
|
|
|
|
|
|
|
|
- `div` and `mod` also sense for rationals, polynomials and Gaussian integers, but `toInteger` does not.
|
|
|
|
`Ord`, `Num(abs, signum)` and `toRational` don't make sense for polynomials and Gaussian integers.
|
|
|
|
`quot` and `rem` assume an ordering.
|
|
|
|
|
|
|
|
### The Fractional class
|
|
|
|
|
|
|
|
|
| ... | ... | @@ -81,7 +76,9 @@ Issues: |
|
|
|
|
|
|
|
Proposals:
|
|
|
|
|
|
|
|
- Add a field-like superclass adding these operations to the ring-like class.
|
|
|
|
- Add a division ring-like superclass adding these operations to the ring-like class.
|
|
|
|
(A division ring has the same operations as a field, but does not assume commutative multiplication, allowing structures such as quaternions.)
|
|
|
|
- (Could be further split with a semiring subclass.)
|
|
|
|
- Add default
|
|
|
|
|
|
|
|
```wiki
|
| ... | ... | @@ -90,6 +87,15 @@ Proposals: |
|
|
|
|
|
|
|
This is independent of all the other proposals.
|
|
|
|
|
|
|
|
### The Integral class
|
|
|
|
|
|
|
|
|
|
|
|
Issues:
|
|
|
|
|
|
|
|
- `div` and `mod` also sense for rationals, polynomials and Gaussian integers, but `toInteger` does not.
|
|
|
|
`Ord`, `Num(abs, signum)` and `toRational` don't make sense for polynomials and Gaussian integers.
|
|
|
|
`quot` and `rem` assume an ordering.
|
|
|
|
|
|
|
|
## Other standard classes
|
|
|
|
|
|
|
|
### The Read class
|
| ... | ... | |