Hacker News new | ask | show | jobs
by merijnv 4007 days ago
> "Don't be fooled, though: Even in Haskell you can write very ugly code."

> Also very much the case - I've done it!

On the bright side, refactoring ugly code into not ugly code is substantially easier in Haskell than many other languages! ;)

1 comments

It can be. It depends on the reasons your code is ugly. Meaningful refactors are much easier in Haskell. Small, local improvements in clarity aren't going to be substantially different between Haskell and other languages.

Also, it's worth noting that Haskell has a couple ways it can get ugly that are less of an issue in other languages.

First, point-free programming can be incredibly clear when you've got a simple series of transformations of relatively simple data. Sometimes it winds up over-applied, in situations where it would be clearer to break things apart.

Second, most languages enforce a distinction between expression and statement. That Haskell doesn't gives more flexibility about how one breaks up expressions. This flexibility means that sometimes ideas can be expressed more clearly, but it's an additional thing to learn on the path to writing readable Haskell.