
11 Mar
2012
11 Mar
'12
11:57 a.m.
Can someone remind me why I can't do this: data Digit = D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 deriving (Eq, Ord, Show) instance Num [Digit] where ... -- This isn't allowed I could make Num a => [a] an instance of Num, but I can't make Digit also an instance of Num because D8 + D5 is not a digit. So then I could introduce a ConvertableToNum class, but I feel like I'd be heading down a path with a lot of unnecessary extra type classes. Thanks, Peter