[Haskell-beginners] Feature request: anonymous arguments

Lyndon Maydwell maydwell at gmail.com
Sat Aug 30 08:08:44 UTC 2014


Often this is sidestepped by using partial application since most functions
are curried, although, I can still see this being useful.

Ex.

f a b c = a + b - c
g = ((-) .) . (+)

Clearly this isn't as intuitive a definition, but it does remove the
argument names.

I can't help but think that there must be some gnarly lens that solves
this, but I can't think of one :)


On Sat, Aug 30, 2014 at 5:21 PM, Julius Gedvilas <xged90 at gmail.com> wrote:

> Anonymous argument (AA) is an argument without a name.
>
> w/o AA:
> func :: a -> a -> a -> a
> func aa0 aa1 aa2 = aa0 `op` aa1 `op` aa2
> \aa0 aa1 aa2 -> aa0 `op` aa1 `op` aa2
>
> w/ AA:
> func :: a -> a -> a -> a
> func = \0 `op` \1 `op` \2
> \-> \0 `op` \1 `op` \2
>
> AA syntax: '\n', where n is one of the (0 1 2 3 4 5 6 7 8 9). 'n'
> corresponds to the position of a parameter.
>
> I think a language shouldn't force you to invent names for things that are
> used only once, same philosophy as with an anonymous function.
>
> Is this feature needed? Does something like this already exist?
>
>
> _______________________________________________
> 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/20140830/b27ee997/attachment.html>


More information about the Beginners mailing list