virtual functions

Rahul Bhargava hul@progsoc.uts.edu.au
Sat, 24 Nov 2001 10:54:22 +1100 (EST)


Hi,

I seek an elegant solution to introduce in Haskell code (with GHC as it is
currently) with capabilities akin to virtual functions in C++.

Say, I have a module with functions for serial operations. I want to introduce
another module with distributed operations but maintain function names.
Polymorphism should resolve which underlying function is to be called by
checking whether the caller wants to perform operations on a serial or a 
distributed structure.

Example,

sum sums elements in a local list.
sum in the distributed module works on distributed lists.
A third sum should sit on top of things and be visible to the user which
chooses which sum is being talked about based on context.

Cheers
Rahul