[Haskell-beginners] anonymous arguments

David McBride toad3k at gmail.com
Sun Dec 29 21:27:08 UTC 2013


I've seen the question asked on stackoverflow before.  It will be a very
subtle bug that scala does not catch for you.  You just have to have the
discpline not to nest multiple anonymous functions with underscore
arguments.  There's no way for the compiler to disallow it because it
cannot tell a mistake from something that is intentional.


On Sun, Dec 29, 2013 at 8:39 AM, harry <voldermort at hotmail.com> wrote:

> Twan van Laarhoven <twanvl <at> gmail.com> writes:
>
> > If you write
> >
> >      map (foo 4 'f' (bar _) 5 'j')
> >
> > How would the compiler know whether you meant
> >
> >      map (\x -> foo 4 'f' (bar x) 5 'j')
> > or
> >      map (foo 4 'f' (\x -> bar x) 5 'j')
> > ?
>
> Interesting question, what does Scala do for this? I guess there would be a
> rule of always binding to the outermost or innermost scope.
>
>
>
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20131229/4e040f9c/attachment.html>


More information about the Beginners mailing list