4 ms·
> These misunderstandings let people write clumsy code like do putStrLn "text" Is it really a problem that newcomers write things like that? It doesn't make th
by unhammer 6y ago
> These misunderstandings let people write clumsy code like do putStrLn "text"
Is it really a problem that newcomers write things like that? It doesn't make the program any slower or more buggy. It's trivial for a code-reviewer to fix. If the new haskellers have hlint installed, they'll get a hint to simplify it and eventually they'll learn the idiomatic way. (And the readFile/writeFile example was just fine before being "fixed".)
- _ikke_ 6y agoFor me, that's similar to writing if(var == true) { } It's more verbose than necessary, but not wrong.
- iso-8859-1 6y agoIn Python and JavaScript it is also asserting the type of the thing being compared, which, I argue is better code style. It is a mess having to think about all those things being truish.
- ghostwriter 6y ago> they'll get a hint to simplify it and eventually they'll learn the idiomatic way. I can confirm that, the recent IntelliJ Haskell (https://plugins.jetbrains.com/plugin/8258-intellij-haskell https://plugins.jetbrains.com/plugin/8258-intellij-haskell) does a pretty good job notifying beginners about redundant "do" blocks and eta-reduction possibilities (with a help from HLint). The redundant blocks are even highlighted in real-time right on the editor.