argon icon indicating copy to clipboard operation
argon copied to clipboard

Extensions from the cabal file are not picked up

Open mohsen3 opened this issue 8 years ago • 6 comments

I have a project in which I specified a few commonly used ghc extensions inside the cabal file. It seems to me that argon does not pickup the extensions from the cabal file, since I am getting a lot of errors. If I put the extension at the top of the module {-# LANGUAGE BangPatterns #-} it works fine.

mohsen3 avatar Feb 18 '16 23:02 mohsen3

It seems that the problem comes from the extFromBI function in the Argon.Cabal module. It only looks at defaultExtensions, while the extensions in my cabal file are listed (for reasons that I don't understand) under the oldExtensions. I fixed the issue by adding the oldExtensions and otherExtensions to the list. I can make a pull request if you like.

mohsen3 avatar Feb 19 '16 02:02 mohsen3

I looked into this when I first added the feature. But from Cabal's documentation it wasn't entirely clear what was oldExtensions for. Since in your case it only works with that change, feel free to open a PR!

rubik avatar Feb 19 '16 08:02 rubik

I made a PR that considers the otherExtensions and oldExtensions for the library section of the cabal file. Why don't you consider the extensions in the executable, test, and benchmark sections?

mohsen3 avatar Feb 19 '16 21:02 mohsen3

Thanks! I don't want to pull in all the other extensions because they could not be relevant and could break the parsing. It's probably better to add a CLI option to specify add custom extensions, just like -X does with GHC.

rubik avatar Feb 20 '16 08:02 rubik

I totally agree that the -X option is a helpful one. I think the correct way to handle cabal files is to parse the source folder path as well as the extensions for each target and use the per target extension list instead. That's what cabal does. Are you using the cabal files for anything other than finding the extension list? It is not clear from the documentation of the command line options, I think.

mohsen3 avatar Feb 21 '16 10:02 mohsen3

Good suggestion. Currently, Argon just reads the extensions from the cabal file. I'll open two new issues for these features.

rubik avatar Feb 22 '16 11:02 rubik