
20 Dec
2008
20 Dec
'08
6:36 p.m.
On Sat, Dec 20, 2008 at 4:28 PM, Maurício
Hi,
Why isn't the last line of this code allowed?
f :: (TestClass a) => a -> Integer f = const 1 a = (f,f) g = fst a
Yep, monomorphism restriction. a, because it is syntactically not a function, must not be typeclass polymorphic (without a type signature). So it tries to default, and TestClass probably doesn't have any defaults. Luke
The only thing I can think about is monomorphism restriction, but it's allowed (or even the third line would not be accepted). Is there something I could read to understand that?
Thanks, Maurício
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe