Flipped function application

David Menendez dave
Thu Oct 10 18:18:11 UTC 2013


On Thu, Oct 10, 2013 at 1:08 PM, Wvv <vitea3v at rambler.ru> wrote:

> We want to combine all of them, like
>
> xs # map $ (+ 3) . snd
>
> And xs $$ map $ (+ 3) . snd  - don't look nice.
>

That's actually a pretty good example of why this is a bad idea. You can't
know which argument is being applied first unless you know the precedence
levels.

In fact, according to the fixity you initially proposed, that translates to

(xs # map) $ (+3) . snd

The corrected version, xs # (map $ (+3) . snd), isn't much better. Even
with the parentheses, it's needlessly confusing. ($) and (#) should never
appear in the same expression, or at least they shouldn't apply arguments
to the same function. It would be like using (.) and (>>>) together.

-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/libraries/attachments/20131010/89766ae1/attachment.html>




More information about the Libraries mailing list