Add -fcompact-holes.
Needs RevisionPublic

Authored by kosmikus on Nov 18 2018, 9:22 AM.



This adds a -fcompact-holes flag that prints typed hole
error messages in a more compact format.

Also adds a user guide entry for the flag and test cases.

kosmikus created this revision.Nov 18 2018, 9:22 AM
tdammers requested changes to this revision.Nov 19 2018, 4:57 AM
tdammers added a subscriber: tdammers.

Not sure if these two are actually worth fixing, but thought I'd mention them anyway.


Looks like a mild case of Boolean Blindness to me - iow, having data HolePrinting = PrintHolesNormally | PrintCompactHoles or something like that here would probably increase clarity (and have the compiler remind us when we flip the arguments)


This long list of possible hole fits makes me a bit uneasy, because it means that there is a high chance of unrelated changes (adding things to Prelude, or changing the type of something in Prelude) leading to this test failing - even though the regression it is supposed to detect isn't present.

The most pragmatic solution I can think of would be to use an explicit Prelude import here, with just a small list of things that we absolutely need to have in scope, and designed to minimize the chance of future type changes; then the expected output will be both smaller and less likely to deviate in the case of an unrelated change to Prelude.

This revision now requires changes to proceed.Nov 19 2018, 4:57 AM

Thanks for the review.


I'm happy to do that, and probably would have if there hadn't been another Bool argument for the filtering already. But you're also right that it's actually making the situation much worse, because there are now two Boolean arguments in direct succession.

Do you think I should introduce a data for the other Bool argument as well then, even if that'd be an unrelated refactoring?


This is an adapted copy of an already existing test case, namely holes.hs, which suffers from exactly the same problem. I am nevertheless happy to change it though.

I put the patch on gitlab:

I'll try and push it through review now as I want to be able to use this flag.