16 Jan
2001
16 Jan
'01
2:11 a.m.
How do you do OOP-style polymorphic functions in O'Haskell? My first attempt looked something like this: struct Base struct Derived < Base = value :: Int theValue :: Base -> Maybe Int theValue x = Just (x.value) -- problem line theValue _ = Nothing In the problem line, x is considered to be of type Base, so x.value gives an error. I tried replacing it with theValue (x :: Derived) = Just (x.value) ...but that doesn't work either. -- Ashley Yakeley, Seattle WA