
10 Jul
2006
10 Jul
'06
11:20 a.m.
David Roundy wrote:
I'm sure I'm missing something lame here, but can someone tell me why we apparently can't declare a list to be an instance of a class in Haskell 98?
I think it is a "feature" of H98 intended to disallow any possibility of overlapping instances. If you have... instance Vec [Double] ...there's nothing from stopping you from also declaring... instance Num a => Vec [a] ...but since Double is a member of Num, which instance should the compiler use?
Or is there perhaps some other syntax by which I'd declare this instance?
Not by the looks of section 4.3.2 of the Haskell Report (at least by my reading). Greg Buchholz