[Haskell-cafe] Readable Haskell

YueCompl compl.yue at icloud.com
Mon Sep 21 08:18:33 UTC 2020


I'd like to understand this issue from the psychological aspect, that readable doesn't mean reasonable that much, while being readable well serves Illusion of control [1] of projects under management, for bosses in Bullshit Jobs[2], we actually need to be in flow state [3] to properly reason about (including reading) an important piece of code. It's not possible with just trivial effort or even in a hurry, even you wrote the code yourself, if not in resonance with the mindset behind the code.

Within many (usually large) corporate codebase, you can easily read any small unit of code, so as to perceive that all of them are doing really useful things for each's own purpose, but very hard to discover how business goals can be fulfilled by the whole codebase. So long as business consultants and stakeholders don't speak a programming language, code in our PL won't express business logics directly. I had assumed the role of a translator between programmers and business users earlier in my career, i.e. doing requirement analysis & design implementation per ad-hoc basis, I would suggest that there are really big gaps.

I love Haskell and I'd like to say, I don't expect Haskell code being easy to read, but for truly effective definitions of the problem and the solution, Haskell code should be really easier to reason about with the ultimate goal in mind.

[1] https://en.wikipedia.org/wiki/Illusion_of_contro <https://en.wikipedia.org/wiki/Illusion_of_control>
[2] https://en.wikipedia.org/wiki/Bullshit_Jobs <https://en.wikipedia.org/wiki/Bullshit_Jobs>
[3] https://en.wikipedia.org/wiki/Flow_(psychology) <https://en.wikipedia.org/wiki/Flow_(psychology)> 

Compl

> On 2020-09-19, at 23:02, Misja Alma <misja.alma at gmail.com <mailto:misja.alma at gmail.com>> wrote:
> 
> Hi,
> 
> I have been writing Haskell in my spare time for a couple of years now, but when I showed some code lately to a friend he remarked that he didn't find it very readable. Actually I agree, when I look at my own code of a couple of months old I have trouble figuring out too what exactly it is doing.
> 
> I'm coming from a Java and Scala background and there, especially for Java, are some generally accepted best practices that make sure that your teammates don't have too much trouble reading your code. E.g. write short functions with a single responsibility, use variable, class and function names that explain what they are meant for, etc.
> 
> I think some of those best practices, like short functions with single responsibility, are useful for Haskell as well. But Haskell is a different language than Java and has its own strong points and pitfalls regarding readability, so it probably needs different coding standards as well.
> 
> I have been looking on the Internet if I could find some tips about improving readability but all I could find was http://www.haskellforall.com/ <http://www.haskellforall.com/>. Although there are some useful tips in there, this site seems to be aimed at making Haskell easier to read for newcomers from other languages. What I am interested in are tips from real projects that are built by real teams.
> Does anybody have any tips, or are there some sites or books that I could read about this topic?
> 
> Thanks,
> Misja
> 
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe <http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe>
> Only members subscribed via the mailman list are allowed to post.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200921/a5d7b2bb/attachment.html>


More information about the Haskell-Cafe mailing list