Hacker News new | ask | show | jobs
by SkiFire13 13 days ago
> GHC’s default algorithm works greedily: it grabs the longest run of independent statements from the front, emits it, and repeats.

I'm not sure I follow. If I had to write a greedy algoritm for this I would do a topological sort in O(n²) and then set the level of each expression to one bigger than the maximum level of its dependencies (again O(n²) worst case)