
9 Nov
2003
9 Nov
'03
3:44 p.m.
Consider:
class Thing t where thing :: t
instance Thing Int where thing = 0
instance Thing Char where thing = 'a'
Can someone please explain why
fst (1,thing)
...gets an 'ambiguous type variable' error, but
fst (1,undefined)
...doesn't? And is there anything I can change to make the former work as well? Even modifying fst doesn't work:
fst' :: Thing b => (a,b) -> a fst' (~a,~b) = a
--
~ Jared Warren