
28 Apr
2009
28 Apr
'09
7:05 a.m.
On Mon, Apr 27, 2009 at 11:00 PM, siki
I'm not sure if this is possible at all. I'd like to do something like this:
class A a where foo :: a -> Double
foo a = 5.0
class (A a) => B a where foo a = 7.0
I probably don't understand the question properly, but I don't see why you would need another class here. Why not : module Main where class A a where foo :: a -> Double foo _ = 5.0 data Blah = Blah data Bar = Bar instance A Blah instance A Bar where foo _ = 7.0 blah = Blah bar = Bar main = do print $ foo blah -- prints 5.0 print $ foo bar -- prints 7.0