3 ms·
I have a commit on GHC (a very modest one). The compiler is written in a mix of somewhat old Haskell style and new which makes sense since it's one of the oldes
by danharaj 8y ago
I have a commit on GHC (a very modest one). The compiler is written in a mix of somewhat old Haskell style and new which makes sense since it's one of the oldest and largest codebases in the language. There is a constant drive to modernize it and some new techniques come out of GHC architectural changes [0].
I didn't work with the parser, mostly the constraint solver in the type checker. Still, I browsed quite a bit of code. It's one of the most pleasant and well documented codebases I've worked in in any language. In particular, the [note] system is an excellent way to embed long form documentation that touches many components without using fancy doc tools: grep suffices.
If you want to see what a large, old, industrial grade Haskell project looks like I think GHC is a good place to look. And if you ever run into trouble with GHC then I encourage you not to be afraid to hack on it. The code won't bite and the maintainers have no shortage of patience for newcomers.
[0] https://arxiv.org/abs/1610.04799 https://arxiv.org/abs/1610.04799
- piinbinary 8y agoI appreciate the pun in that paper: Algebraic Data Types (ADTs) and pattern matching in functional languages lay a fertile ground to conveniently define and process data types as tree-like structures. However, in these grounds, trees often cannot grow; once a data type is defined and compiled, its definition cannot be extended.
- endgame 8y agoCan you go into more detail about the [note] system?
- ufo 8y agoSimon Marlow and Simon Peyton-Jones wrote a chapter about GHC for the Architecture of Open Source Applications ebook and they talk about the note system there. Skip to section 5.6. http://www.aosabook.org/en/ghc.html http://www.aosabook.org/en/ghc.html