Koen Claessen wrote:
> So, the Haskell compiler gives also an error here. I don't see the
> difference between "The class variable must occur in every method type"
> (Haskell) and "All the class variables must occur in every method type"
> (Gofer).
> The Gofer way is rejected, because it is ambiguous, but Haskell
> has the same problems, even with one type variable. What I am trying to
> say is that this problem hasn't got anything to do with the number of type
> variables.
> Koen.
In my original reply to Erik's message, regarding replacing the Haskell type
system with that of the Gofer system, I was not trying to imply that everything
was OK with the Haskell type system. Haskell has been designed, as far as I
can tell, with the objective that it should be used for a variety of
different programming tasks. It was not the goal of Haskell to be aimed
completely at research, this is just one application of many. So with this
in mind my original message can be considered at trying to state the following:
The current Haskell type system has limitations, not least the
fact that it cannot support multiple parameter type classes. However,
the support for both overlapping instances and multiple parameter type
classes in Gofer also has it's problems. The example, taken from
Chen, Hudak and Odersky (see my early email) was intended to highlight
that there are also reasonable programs, and ideas, that could not be
formulated under the Gofer type system. I did not intended that this
example to be read as stating that ambiguous types were not present
in Haskell.
As discussed in my original email I am aware of at least to alternative
solutions to extending the Haskell type system with multiple parameter
type classes. Both of these are conservative extensions of the current
Haskell type system, which are capable of expressing the example
taken from Chen, Hudak and Odersky.
Many regards
Ben
--------
Benedict R. Gaster.
Functional Programming Group, Nottingham University.
Category theory: This is how our children will program!