ormolu icon indicating copy to clipboard operation
ormolu copied to clipboard

Refactor extraction and caching of CabalInfo

Open brandonchinn178 opened this issue 1 year ago • 5 comments

Broken off from #1033

This change has the following improvements:

  1. Force user to handle missing stanza information (e.g. dependencies) when the cabal file does not mention a source file
    • This would make it much harder to have the same regression as #1032 somewhere else
  2. Make CabalInfo return all info for the cabal file, without reference to the source file
    • Simplifies parseCabalInfo as just "parse cabal file", not "parse cabal file + extract info relevant to given source file"
    • IMO this is clearer, given the names of the types and functions.

brandonchinn178 avatar May 23 '23 00:05 brandonchinn178

I'm happy with the first commit, which I adjusted a bit to apply the new helper to both caching of cabal files and .ormolu files, however I don't think we can easily merge something that changes the signature of refineConfig because it changes the API, which we are supposed to keep backwards compatible now as per c81320d8a1069674c17fa5ee52b64c18604f84de.

mrkkrp avatar Jun 02 '23 13:06 mrkkrp

Ah sure, I could make the changes backwards compatible. Give me a second

brandonchinn178 avatar Jun 02 '23 15:06 brandonchinn178

@mrkkrp how's that?

Also, there's a weeder failure. Maybe weeder.dhall should be updated to include the Ormolu module as a root?

brandonchinn178 avatar Jun 02 '23 16:06 brandonchinn178

Eh, I like splitting the code in two branches (old and new) even less. Let's apply d91bbd064511fee913bd348fc413ba5a820e8927 and keep the rest on the shelf for a while until we decide to release 0.8.0.0 at which point we can make a clean break.

mrkkrp avatar Jun 06 '23 10:06 mrkkrp

Sure up to you

brandonchinn178 avatar Jun 06 '23 14:06 brandonchinn178