On Sat, Dec 20, 2008 at 4:28 PM, Maurício
<briqueabraque@yahoo.com> wrote:
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