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


_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to