[Haskell-cafe] Subtype polymorphism in Haskell
Yitzchak Gale
gale at sefer.org
Tue Jul 6 10:36:36 EDT 2010
Simon Courtenage wrote:
> This is for a project to port an open-source C++ library to haskell.
Great! We'd love to give you whatever support you need
for your efforts.
> My initial plan is to more or less preserve the way the
> library works in the first draft of the port and see how
> far we can get like that
That's fine, as long as you truly mean the way it works,
and not the way the code is structured. Haskell is a post-OO
language. Its abstractions are very different than class
structures in C++. There is no direct translation - any given
C++ class structure could correspond to many totally different
kinds of Haskell programs, depending on what the program
is trying to do.
If you are trying to find a method to transliterate a strongly
OO-style C++ program more or less word for word into
Haskell in a way that the class structure of the C++ will
still be apparent in the result, you are likely in for a frustrating
experience. You will spend a lot more time than you expected,
and the results will be very unsatisfying. Many others have
ended up that way.
On the other hand, if you are willing to be a little more flexible
in your thinking, you'll probably find the task much easier than
you thought, enjoy it, and reap many benefits from the process
that you never imagined.
In any case, please keep us in the loop, we'd like to hear
how it's going. And, uh... would you be willing to share a
few more details about what it is that you're trying to port? ;)
Thanks,
Yitz
More information about the Haskell-Cafe
mailing list