[Haskell-cafe] Word rigid in "`a' is a rigid type variable..."
evohunz at gmail.com
Wed Nov 13 17:52:48 UTC 2013
> 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
I don't think this is quite correct.
As I'm a daily Java programmer, one thing that really troubled me was to
think as `a' being something like `Object', but it is wrong.
The `a' really means that the client of the function can define the type it
wants, and be precise.
I guess it's easier to see this in the value (result) of a function: "f ::
a -> b" is a function that takes any value and produces any value the user
wants, i.e. I can take an Int out of it, or a Double, or a String, or a
Foo, or a Bar. That's a huge difference between Java's "Object f(Object a)"
(a better comparison would be with "<A, B> B f(A a);", I guess).
I'm diverging a bit, but what I want to say is that there is no way to tell
that the type of "b" is "too rigid" for the type `a' , because the `a' can
be anything, even the exact type of "b".
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe