GHC and type-family rewriting?

Richard Eisenberg lists at richarde.dev
Fri Dec 9 04:48:44 UTC 2022



> On Nov 30, 2022, at 9:42 PM, Benjamin Redelings <benjamin.redelings at gmail.com> wrote:
> 
> (Q1) Did GHC evolve to this point starting from something fairly close to the OutsideIn paper?

Yes.

> 
> (Q2) Is the new approach (i.e. eager type family rewriting) mostly to making rewriting faster?

No. Simpler, not faster (and not slower). Or that was the intent.

> 
> (Q3) Does it sound reasonable to implement the approach from the OutsideIn paper, and than gradually transform it to look more like GHC?
> 

Sure, but I'm not sure what the advantage of doing so would be.

This is all my doing: for years and years, GHC's treatment of type families was as described in OutsideIn. But I never could quite figure out why we needed to have flattening variables. And so I got rid of them -- this seemed like a simplification. I'm not sure it really panned out, though: without flattening variables, we need these cycle-breaker variables (which are pretty gross). On the flip side, I think the new approach might enable the possibility of reducing type families only in "strict" positions (e.g. the argument to another type family or perhaps a class during instance lookup). In the end, I don't think either the old way or the new way is the Right Answer. Maybe you can come up with something better than both!

Richard

> -BenRI
> 
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs



More information about the ghc-devs mailing list