
On 21 March 2005 10:24, Thomas Hallgren wrote:
Superclasses are never really needed, are they? But they are useful because they make types smaller and more readable.
Well, superclasses might be required by default methods.
For a given type T which has a Monad instance, you can always declare
instance Functor T where fmap = liftM
so it is not a big burden to have to declare a Functor instance to accompany a Monad instance.
I don't really have a strong view about this, I'm happy to defer to those who know more about it. But I have a slight preference for not having to define Functor instance if I don't need one - lots of little monads in my code would be affected. Also, Monad dictionaries would get slightly larger.
And the Haskell libraries already contain superclass relationships that make less sense than the Functor=>Monad relationship.
This is true. Here's some good background reading that Google turned up: http://www.cs.chalmers.se/~rjmh/Haskell/Messages/Display.cgi?id=444 I think this was part of the original Haskell 98 discussion. Cheers, Simon