[Haskell-beginners] A few really short beginners questions

Daniel Fischer daniel.is.fischer at web.de
Mon Oct 4 08:08:08 EDT 2010


On Sunday 03 October 2010 20:11:47, Andrew Sackville-West wrote:
> But this is not a property of "undefined"
> in this context. You've just given it a name that happens to coincide
> with a reserved word. You could just as easily use "x" or "foo" or
> whatever in the same way. Note that commonly, if you are not going to
> use the argument to a function, you use "_" to prevent it from being
> bound at all.

Minor correction, "undefined" is not a reserved word (like e.g. "data" is), 
it is just a variable (or name) bound in the Prelude.
You can shadow predefined names like undefined, otherwise etc., but not 
reserved words, so

f data = 3

won't compile while

f undefined = 3

will.


More information about the Beginners mailing list