[Haskell-cafe] Subtype polymorphism in Haskell

Yitzchak Gale gale at sefer.org
Tue Jul 6 06:48:32 EDT 2010

Simon Courtenage wrote:
> I am porting a C++ program to Haskell.  My current task is to take a class
> hierarchy and produce something equivalent in Haskell

Did you define that task for yourself, or is someone else asking
you to do it?

There really isn't anything equivalent in Haskell. Typeclasses in
Haskell are not the same as classes in C++. You may or may
not need typeclasses in your Haskell program (probably not),
but whether or not you need them and how you will structure
them if you do has little or nothing to do with what the class
hierarchy looks like in C++.

The only way to do a good job of porting a program from C++
to Haskell is to begin with a description of what the program
does and what its requirements are.


More information about the Haskell-Cafe mailing list