Simon suggests that:
| type classes can model extensible records.
Indeed, they can, and in several different ways, depending on the kind
of extensible records that you want to give the programmer. The particular
system that Simon outlined is pretty close to a proposal for `structures in
I missed out on the discussion about multiple parameter type classes
last time round, so I'm pleased to have another chance to say my piece.
I added multiple parameter classes to Gofer at a time when there
was quite a lot of discussion on this list about such classes.
I'd been involved in
| I'm fairly sure that local definitions were possible in Miranda(TM), and
| I see they are permitted in Gofer. Mark Jones explains why they are not
| part of Haskell, on page 44 of the Gofer manual:
|
| Local definitions: A qualifier of the form pat = expr [...]
|
| [
Here's an idea, going back a few years, for a small extension to
Haskell that would make it a little easier to define datatype
selector functions. I'm curious to see what other people think
about it, but I'm not sure that I want to put this forward as
a proper proposal for 1.3 or 2.0 or ...
The bottom line: Equational reasoning in a typed language needs to
take account of types.
For those who would like me to go into a little more detail:
Warren has described a puzzling situation in which the two similarly
defined functions:
f1 x y = const (show x == show y)
In response to some comments from Nikhil:
| Thomas says:
| AN ASIDE: Actually, in this example, what I *really* wanted was a
| definitional list comprension (Kevin, was that what you called it?
| You wrote a note about this ages ago):
| So that a qualifier can also be a
Van Snyder (= [EMAIL PROTECTED]) asks why the following definition
doesn't work:
| q :: (Integral d) = Array d (Array d d)
| q = array (1,2) [1 := array (1,3) [j := j | j - [1..3]]] ++
| [2 := q!1]
The reason is that it is missing some parentheses. Using the rule
that
Konstantin Laufer [EMAIL PROTECTED] writes:
| Consider the following recursive function binding:
|
| f [] = 0::Int
| f (x:xs) = 1 + f([]::[Int]) + f([]::[Bool]) + f xs
|
| This binding is ill-typed since f is used in two different instances
| of its polymorphic-to-be type.