On Wed, Nov 13, 2013 at 11:37 AM, Vlatko Basic
f :: a -> Bool f a = let b = "x" in a == b
compiler complains with `a' is a rigid type variable bound by the type signature for f :: a -> Bool
I'm puzzled with the choice of word 'rigid' here. I see these types as - 'b' has "rigid/unchangeable" type (only String), and - 'a' has "soft/variable" type (any type, no constraints).
The type declaration is the final arbiter. Since it says "any type", it means exactly that: you are claiming your function is prepared to handle *any type* the caller wishes to specify. It is not "soft", nor "variable" in the sense you intend: it is a hard requirement that your function must be prepared to handle whatever type the caller wants there. But instead your function requires that it be String, because both sides of (==) must be the same type. This violates the type signature'a assertion that the caller can specify any type. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net