Multi-parameter OOP
Ashley Yakeley
ashley@semantic.org
Fri, 19 Oct 2001 16:08:57 -0700
At 2001-10-19 08:02, George Russell wrote:
>a naive user (like me a month ago) might expect that this to work, so that
>toBool (WrappedA a) (WrappedB b) will return False unless a is an A1, and
>b a B1, in which case it returns True.
I think existential types are arranged so that Haskell never needs to
store type information in them at run-time. So you'll never be able to do
dynamic OOP with them.
One possible extension to Haskell for dynamic OOP, which I never tire of
suggesting, is the extensible datatype, for instance:
module P
data BaseType = B1 | B2 | _
module Q
data DerivedType = D1 | D2
data BaseType |= BD DerivedType
--
Ashley Yakeley, Seattle WA