Class or parameterized type?
Graham Klyne
GK@ninebynine.org
Wed, 19 Mar 2003 05:21:52 +0000
At 18:42 18/03/2003 -0800, oleg@pobox.com wrote:
> > Example: I wish to define a structured container type, let's call it a
> > "RatsNest", that is type-variable in two ways:
[...]
>Do you consider the standard design lacking? For example,
I wasn't aware there was a standard design, but you have given me some
pointers. Thanks!
Studying your code was very interesting for me, as it has shown me
something more of the kinds of idiom that work with Haskell.
Concerning my question, I think the key part of your code is in:
[[
class (RatTail t) => RatNest c t where
]]
which I think is exactly what I was looking for, and is not a Haskell
structure I've come across before. (I assume that this form does not
indicate that RatNest... is a subclass of RatTail (as opposed to saying
(RatTail t) => RatNest t); I certainly wouldn't want to have that.)
I suppose this is the multi-parameter type class extension you
mentioned. Can you say where this extension is described, and how widely
implemented it is?
Thank you for your response, I found it most helpful.
#g
-------------------
Graham Klyne
<GK@NineByNine.org>
PGP: 0FAA 69FF C083 000B A2E9 A131 01B9 1C7A DBCA CB5E