This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How do we add extra information to a tree? This has been called [The | |
AST Typing | |
Problem](http://blog.ezyang.com/2013/05/the-ast-typing-problem/). | |
After being hit with this problem in Roy's new type-inference engine, | |
I tried figuring out how to represent the algorithm. I eventually | |
realised that it looked like a comonadic operation. Turns out it's | |
been done before but I couldn't find any complete example. | |
Below is some literate Haskell to show how to use the Cofree Comonad |