Essentials of Programming Languages in Haskell
This repository shows my long-term learning of Haskell and interpreters of programming languages, wish I can finish the whole book!
Reader
Monad: elegant, safe to use
State
Monad: ugly, prone to memory leak, and if you need to mimic mutable byState
, perhaps you need to just use mutable references.
To check if files are already formatted (useful on CI):
$ fourmolu --mode check .
Find all the source files in a project with git ls-files
and then use fourmulu
to format those files:
$ fourmolu --mode inplace $(git ls-files '*.hs')
# Or to avoid hitting command line length limits and enable parallelism (12-way here):
$ git ls-files -z '*.hs' | xargs -P 12 -0 fourmolu --mode inplace
-
Thanks That One Cool Reader Trick, which teaches me the cool trick!
-
Thanks About that Reader trick, which teaches me the disadvantage of the
Reader
. -
Thanks Lecture_EOPL, which reminds me to get started on my project and as my reference.