On Friday 02 November 2001 4:46 pm, Rijk-Jan van Haaften wrote: > Therefore, you have to tell GHC the exact type of "textNew Nothing Nothing" > with a type annotation, just like in the examples with show above: > > txt <- textNew (Nothing :: Maybe SomeDefaultAdjustmentClass) Nothing
Ah yes, I'd forgotten you could do that these days. This still lacks elegance IMHO, but it's not quite as bad as what I proposed. Thinking about this, it occurs to me that maybe this kind of ambiguity could be safely ignored by the compiler if the following constraint was enforced... Functions can only make use of class methods if they have been given a genuine class member in an argument. The compiler could check this quite easily I think. Either the function does pattern matching on the argument, or it passes the argument (and method table) on to another function which is similarly constrained. Either way it's safe. So in situations like this the compiler could use some suitable dummy method table with confidence, knowing it would never be used. Would this be possible? I suppose if the methods include functions which don't take a class member as an argument (or constants) this could cause problems. Just an idea. I don't think this would help with your show example though, which as you observed, is ambiguous for a different reason. Regards -- Adrian Hey _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell