[Haskell-beginners] A few really short beginners questions

Andrew Sackville-West andrew at swclan.homelinux.org
Mon Oct 4 12:48:25 EDT 2010


On Mon, Oct 04, 2010 at 02:08:08PM +0200, Daniel Fischer wrote:
> 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.
>

Thanks!

A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/beginners/attachments/20101004/cbd2c34e/attachment.bin


More information about the Beginners mailing list