|Version 14 (modified by 10 years ago) (diff),|
Issues with Standard Classes
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 or something similar, but such features are not yet implemented.
The Functor class
- Add instances for
The Monad class
- Monads are really functors, but programmers can't always assume that
fmapis defined for them, and so must use
liftMinstead. Similarly, code parameterized by
Functorcannot be used with monads.
failmethod was added to the class in Haskell 98 to implement pattern match failure in
doexpressions. However the assumption that errors are strings can be problematic (e.g. cf the
Errorclass in Control.Monad.Error, or for internationalization).
- Add instance for
Functora superclass of
Monad. This would impose an extra burden on those who just want to define a
joina method of
Monad, interdefined with
- A more extreme step down this road would be to interpose the new Applicative class between
Monad, with corresponding renaming of methods.
Other standard classes
The Read class
The Enum class
- The default definitions of
enum* would make more sense if
- Some doubt that it makes sense to have
- It is wierd that
The Ix class
- There is no portable way to report indexing errors accurately.
Showa superclass of
Ix, so that the offending index and range can be shown in exceptions. (All instances of
basepackage are also instances of
The Bits class
Numsuperclass may unduly restrict instances. The only thing actually needed from
bitSizemethod is not defined for all instances, and there is no general way to test whether it can be safely called.
The Storable class
- Some interfaces require clients to manage the memory for objects, but to treat them abstractly. In such cases one wants to define
alloca), but not