[Haskell-cafe] Re: Is this related to monomorphism restriction?
briqueabraque at yahoo.com
Sun Dec 21 12:21:14 EST 2008
>> Why isn't the last line of this code allowed?
>> f :: (TestClass a) => a -> Integer
>> f = const 1
>> a = (f,f)
>> g = fst a
>> The only thing I can think about is monomorphism
>> restriction, but it's allowed (...)
> (...) The reason is that a has type
> a :: (TestClass a, TestClass b) => (a,b)
> and then when we take 'fst' of this value (as in g) we get
> g :: (TestClass a, TestClass b) => a
> which is an ambiguous type, (...)
Is there some version (i.e., set of extensions) of
Haskell where this would be allowed?
More information about the Haskell-Cafe