Thanks for explanation. If I understood correctly, 'rigid' refers  the requirement, not the type itself.

I think that more intuitive/understandable would be something like

    'b' has too rigid type for 'a' ...

At least, that is what I have to tell myself when I encounter this issue


vlatko
-------- Original Message --------
Subject: Re: [Haskell-cafe] Word rigid in "`a' is a rigid type variable..."
From: Brandon Allbery <allbery.b@gmail.com>
To: Vlatko Bašić <vlatko.basic@gmail.com>
Cc: Haskell-Cafe <haskell-cafe@haskell.org>
Date: 13.11.2013 17:53


On Wed, Nov 13, 2013 at 11:37 AM, Vlatko Basic <vlatko.basic@gmail.com> wrote:
    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