[Haskell-cafe] Eq Type Class: Overloading (==)

Tom Hawkins tom at confluent.org
Sun Sep 18 07:59:51 EDT 2005

Aaron Denney wrote:
> On 2005-09-17, Jason Dagit <dagit at eecs.oregonstate.edu> wrote:
>>A link to supertyping can be found here:
>>After reading that, I wonder why it's not implemented.
> Not enough people calling for it.
>>It seems like a wonderfully useful idea.
> It is.  It would be terribly useful for those trying to prototype a
> new Prelude, and clean up the mathematical structures.

I like the idea of supertyping, but wouldn't that only allow you to 
alter identifiers that were already classified?  What about functions in 
the Prelude that don't belong to a type class?

For instance, I have a datatype that needs an append-like operation, yet 
it appears (++) is reserved only for lists.

I recently switched to Haskell from OCaml because I thought type classes 
may solve one of my problems.  I'm building an embedded language, which 
has a lot of the basic operations.  In OCaml I was forced to invent all 
sort of obscure operator names for the embedded language so as not to 
collide with the standard library.

But with Haskell's Num class, I have been able to reuse (+), (-), and 
(*).  However, (==) and (++) are still sticking points.  My general 
impression of Haskell is good, though it seems you're somewhat locked-in 
by how the upper levels of the class hierarchy are defined in the 
Prelude, or when the Prelude does not type class generic operator names 
such as (++).

Again, I just stared programming Haskell.  Please let me know if I'm 
missing something.



More information about the Haskell-Cafe mailing list