tweag / ormolu

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

--ghc-opt always erroneously reports unrecognized options #484

Closed Avi-D-coder closed 4 years ago

Avi-D-coder commented 4 years ago

This is related to #437 & #438.

$ echo 'idString = id @String' | ormolu -o TypeApplications
The following GHC options were not recognized:
  TypeApplications

Removing src/Ormolu/Parser.hs:208 gets rid of the error message, but ignores TypeApplications. Output: idString = id@String

    case NE.nonEmpty leftovers of
      Nothing -> return ()
      Just unrecognizedOpts ->
        throwIO (OrmoluUnrecognizedOpts (unLoc <$> unrecognizedOpts))
mrkkrp commented 4 years ago

As you seem to have discovered by now, the problem is that GHC options for language extensions begin with the -X prefix, which is how you should provide them.