Proposal: ArgumentDo

C Maeder chr.maeder at web.de
Mon Jul 11 08:27:44 UTC 2016


Hi Sven,

a wrongly spelled keyword will soon be detected by the checker in either
cases.

Readability is the responsibility of programmers. It is up to you or a
team to use parentheses for the examples below. (I find a line break and
indentation to be sufficient.)

(I know people - mostly beginners - that insist on using "if b then True
else False" instead of "b" for readability reasons.)

Surely, a grammar could enforce more redundancy, but this is usually
considered as an annoyance (in particular for instance distant closing
tags that are more or less hidden in a pile of other closing tags).

The $-notation was (in the first place) only used (and maybe misused) to
avoid additional parentheses.

Haskell's strong typing is the major safeguard (against spelling errors).

Cheers Christian

Am 11.07.2016 um 08:31 schrieb Sven Panne:
> 2016-07-10 11:28 GMT+02:00 C Maeder <chr.maeder at web.de
> <mailto:chr.maeder at web.de>>:
> 
>     [...] Why does an explicit infix operator make such a big difference
>     for you?
> 
>       (if c then f else g) $ if d then a else b
> 
>       (if c then f else g)  if d then a else b
>     [...]
> 
> 
> Because at first glance, this is visually only a tiny fraction away from
>  
>    (if c then f else g)  it d them a elsa b
> 
> which would be parsed in a totally different way. (Personally, I think
> that if/then/else is useless in Haskell and just a concession for
> readers from other programming languages. Having a plain old "if"
> function would have done the job in a more consistent way.) Of course
> syntax highlighting improves readability here, but code should be easily
> digestible in black and white, too. Visual clues matter...


More information about the Glasgow-haskell-users mailing list