[Haskell-cafe] Language complexity & beginners
Mike Meyer
mwm at mired.org
Tue Feb 9 18:03:39 UTC 2016
>
> The point I have tried to convey was that:
>
> - the ))) ( patterns are hard to parse visually
> - the $ helps to alleviate that
>
> ..which is fairly orthogonal to common subexpression elimination or
> formatting.
>
> $ allows one to write more complex expressions -- precisely without
> resorting to diluting code with formatting.
>
I agree, but '$' still needs to be used with a bit of care. For instance,
given these choices:
> someFn $ someOtherFn $ more $ more $ val
> (someFn . someOtherFn . more . more $ val)
> someFn (someOtherFn (more (more val)))
I like one not on the list:
someFn . someOtherFn . more $ more val
as it's simpler in that there are fewer things to parse than the other
options. The middle option in the first three without the extra global
'()'s is close, and might even be better in context once they are removed,
but the last one makes me long for he old LISP super-parens, even though I
thought and still think they were a bad idea.
So my rule of thumb is one '$' for expression or sub-expression, using '.'
instead of '$' prior to that to make the distinction between building a
functional value and applying it stand out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160209/a4e91d89/attachment.html>
More information about the Haskell-Cafe
mailing list