Add Text.Megaparsec.Error.errorBundlePrettyForGhcPreProcessors
#573
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If you use
![before](https://private-user-images.githubusercontent.com/461132/385536673-61beb2ec-58c2-43c0-b3e7-2d60ed874c34.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NTQ2MDEsIm5iZiI6MTczOTU1NDMwMSwicGF0aCI6Ii80NjExMzIvMzg1NTM2NjczLTYxYmViMmVjLTU4YzItNDNjMC1iM2U3LTJkNjBlZDg3NGMzNC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQxNzMxNDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kNmNmZGNjOGMwZGZhNTlkMDc2NTI1ZWYxZWQzOWIwMTdjMjM3N2E0ZjI5NmExZTk1NWE4YTNhNDQwMzFjZWE1JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.cdl4hCc6354SVvhoP5wc6lItNMuFnygZ1KA9_kwIWVU)
errorBundlePretty
when writing a GHC pre-processor then error output does not look pretty:To address this, this PR adds
![after](https://private-user-images.githubusercontent.com/461132/385536703-c4510299-6bec-483c-9301-84149c3c75da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1NTQ2MDEsIm5iZiI6MTczOTU1NDMwMSwicGF0aCI6Ii80NjExMzIvMzg1NTM2NzAzLWM0NTEwMjk5LTZiZWMtNDgzYy05MzAxLTg0MTQ5YzNjNzVkYS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQxNzMxNDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00MmUxYjc1Nzg0ZDAxNDNlNTkwZTg5ODdkNDE1NjgxNTRhMjMxMWMxODQzODNiOWRmOGFkYTRmOGNhMDNkMTk4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.ecVsFEZ__RkQA7rBI0r5HoX69ko1e_BRLTN_SMP-OIw)
errorBundlePrettyForGhcPreProcessors
, which results in:Details:
As a consequence, the best you can achieve for a pre-processor is to have multi-line error messages indented by five spaces. To achieve this you have to produce error messages of the form:
That is:
Note that single-line error message should be of the form:
(no space between the last
:
and the error message, otherwise you will end up with two spaces in the pretty-printed output)