tweag / ormolu

A formatter for Haskell source code
https://ormolu-live.tweag.io
Other
950 stars 83 forks source link

Provide more context on Cabal file parsing errors #999

Closed zzantares closed 1 year ago

zzantares commented 1 year ago

When ormolu fails to parse the Cabal file the user doesn't know what is the actual error as only the cabal filepath is reported. This makes the necessary changes to actually show what errors the cabal file parser encountered.

Before:

  Parsing this .cabal file failed:
    /path/to/file.cabal

After:

  Parsing this .cabal file failed:
    /path/to/file.cabal:0:0: Unsupported cabal-version 3.8. See https://github.com/haskell/cabal/issues/4899.

Note: Removing the Eq instance on OrmoluException was the easy way to not having to implement an orphan Eq instance on PError. This does not have any impact elsewhere as we're actually not making use of the Eq instance on this exception type.

mrkkrp commented 1 year ago

As a consequence of c81320d8a1069674c17fa5ee52b64c18604f84de, this actually constitutes now a breaking change :thinking:

zzantares commented 1 year ago

Hey! apologies for the late response, I've applied the suggestions.

BTW if this is a breaking change and brings you guys much pain then feel free to skip this if it suits you; the only thing I really needed was to actually see what was the problem I was running into.

mrkkrp commented 1 year ago

I believe #983 will warrant Ormolu 0.6.0.0, and so we can merge this without any concerns about backwards compatibility.