[Haskell-cafe] what does @ mean?.....

Chaddaï Fouché chaddai.fouche at gmail.com
Fri Dec 28 06:24:51 EST 2007


2007/12/28, Alfonso Acosta <alfonso.acosta at gmail.com>:
> @ works as an aliasing primitive for the arguments of a function
>
> f x@(Just y) = ...
>
> using "x" in the body of f is equivalent to use "Just y". Perhaps in
> this case is not really useful, but in some other cases it saves the
> effort and space of retyping really long expressions. And what is even
> more important, in case an error is made when choosing the pattern,
> you only have to correct it in one place.
>

And in plenty of case it will greatly boost your speed because you
won't be reconstructing the objects against which you matched every
time you want to return them unchanged.

-- 
Jedaï


More information about the Haskell-Cafe mailing list