[Haskell-cafe] Readable Haskell
Vanessa McHale
vamchale at gmail.com
Sat Sep 19 17:03:28 UTC 2020
My 2¢: my style comes from writing silly code and revisiting it and
realizing what to do differently.
I use stylish-haskell to order my import and I use hlint on my code.
I think compared to other languages, one writes more small functions.
And I rely more on haddock + type signatures - I've learned some ways to
avoid writing bad haddocks by getting frustrated by packages on Hackage.
Cheers,
Vanessa McHale
On 9/19/20 10:02 AM, Misja Alma 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/. 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
> 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/20200919/644999f8/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20200919/644999f8/attachment.sig>
More information about the Haskell-Cafe
mailing list