Re:GHC Parser Principles
by piinbinary on Monday May 14, 2018 @10:12PM
(#17071111)
I 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.Can you go into more detail about the [note] system?
Simon 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.
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