Expanding a particular type family in type errors

Alexis King lexi.lambda at gmail.com
Tue May 5 15:43:40 UTC 2020


> On May 5, 2020, at 04:00, Richard Eisenberg <rae at richarde.dev> wrote:
> 
> reportWanteds reports errors, yes, but it also fills in deferred type errors. [snip] It's a bit awkward that a function called reportWanteds does this, but it actually makes good sense, because reportWanteds knows the text that should be in the runtime error call.

Yes, that does make sense; thank you for the explanation.

> You say that they're not, in general, fully known. But are they often known in practice? My suggestion here isn't to remove the type families entirely, but maybe to short-circuit around them. If that's often possible, it takes some pressure off fixing the pretty-printing.

You’re right that this might be feasible, but I think it would be awkward, and it probably would break down just often enough to be an unsatisfying solution.

> I wonder if we should have a preprocessTypeForPrinting :: DynFlags -> Type -> Type function. This could be run *before* the conversion to IfaceType. It could handle both your new idea and the existing idea for -f(no-)print-explicit-runtime-reps. The supplied DynFlags could be gotten from sdocWithDynFlags, I think. I bet that once we have this facility working, we'll find more uses for it.

If you think this is a reasonable idea, I’m happy to give it a shot—it definitely seems like the nicest way to do it to me. I’ll try it out and report back if I run into any trouble. Thanks again!

Alexis


More information about the ghc-devs mailing list