Hacker News new | ask | show | jobs
by _hao 2506 days ago
Trying to read Haskell code without any knowledge of it is interesting to say the least. I like how compact it looks, but I'm guessing a lot of the simple looking statements (at least at first glance) do a lot under the hood. Is that a characteristic of Haskell itself or just the developer has a good style?
2 comments

In Haskell vs other languages, a large amount of your program is written using various forms of composition (function composition, applicative/monadic composition [sequencing of side-effects], monoidal composition [combining values], library-specific composition [e.g. Conduit =$=] etc).

The stuff you compose tend to be small functions that are easy to test & reason about.

The nice thing about composition in Haskell is that if you have correct program A & B, then the composition of A & B is also correct & easy to reason about.

Haskell tends to be terse because a number of features and very general built in functions. The author is also good at Haskell and lacks a lot of ugly optimizations making it look even cleaner.