| ... | ... | @@ -17,6 +17,13 @@ Issues: |
|
|
|
- `succ` and `pred` are unused.
|
|
|
|
- The default definitions of `enum`\* would make more sense if `toEnum` and `fromEnum` used `Integer` instead of `Int`.
|
|
|
|
|
|
|
|
## The Functor class
|
|
|
|
|
|
|
|
|
|
|
|
Proposal:
|
|
|
|
|
|
|
|
- Add instances for `((->) a)`, `((,) a)` and `Either a`.
|
|
|
|
|
|
|
|
## The Monad class
|
|
|
|
|
|
|
|
|
| ... | ... | @@ -24,10 +31,13 @@ Issues: |
|
|
|
|
|
|
|
- Monads are really functors, but programmers can't always assume that `fmap` is defined for them, and so must use `liftM` instead.
|
|
|
|
Similarly, code parameterized by `Functor` cannot be used with monads.
|
|
|
|
- The `fail` method was added to the class in Haskell 98 to implement pattern match failure in `do` expressions.
|
|
|
|
However the assumption that errors are strings can be problematic (e.g. cf the `Error` class in [ Control.Monad.Error](http://www.haskell.org/ghc/docs/6.4-latest/html/libraries/mtl/Control-Monad-Error.html), or for internationalization).
|
|
|
|
|
|
|
|
|
|
|
|
Proposals:
|
|
|
|
|
|
|
|
- Add instance for `((->) a)`.
|
|
|
|
- Make `Functor` a superclass of `Monad`.
|
|
|
|
This would impose an extra burden on those who just want to define a `Monad`.
|
|
|
|
- Make `join` a method of `Monad`, interdefined with `(>>=)`.
|
| ... | ... | |