Visitar URL original
Cabal options get overwritten by commandline options · Issue #52 · hdevtools/hdevtools · GitHub
Skip to content

Cabal options get overwritten by commandline options #52

Open

Description

@merijn

hdevtools takes both GHC options from the cabal file of a project and on the commandline and appens the commandline options BEHIND the cabal options. However, this leads to annoying behaviour when using hdevtools together with, e.g. vim-hdevtools or syntastic which use a global "hdevtools_config" variable.

The problem is this:
If, in my vim config, I have the options -Wall -Wno-unused-do-binds (the default flags I want to use for checking haskell files in the absence of a cabal config) these get appended AFTER the options hdevtools has parsed from my cabal file. Suppose my cabal file has -Wall -Wno-unused-do-binds -Wno-orphans, then appending the -Wall -Wno-unused-do-binds from my vim config ends up overwriting the more project specific -Wno-orphans in my cabal file.

Solutions:

  1. Append cabal options AFTER the commandline GHC options, letting the more specific options dominate. Pros: Trivial change. Cons: Maybe someone DOES want to override the cabal options on the commandline

  2. Add a new way of specifying "default" GHC options, which are only used if no options are succesfully gotten from cabal.

Activity

  1. ch1bo commented on Jun 21, 2017

    @ch1bo
    Member

    Shouldn't your command line options be merged with the cabal options? i.e. calling ghc with -Wall -Wno-unused-do-binds -Wno-orphans -Wall -Wno-unused-do-binds and effectively -Wno-orphans -Wall -Wno-unused-do-binds
    Or said differrently: I would expect in your example that the not overridden option from the cabal file (-Wno-orphans) to be passed to ghc - is this not the case?

  2. merijn commented on Jun 22, 2017

    @merijn
    Author

    Currently it just naively concats both sets of options and since the second set includes -Wall this overrides the earlier -Wno-x flags.

    Later flags override earlier flags for warnings, so -Wno-x -Wall is just -Wall

  3. ch1bo commented on Aug 18, 2017

    @ch1bo
    Member

    Okay I guess I understood your situation. Still I am unsure whether this is really the solution. Can you have a look at #59 and how this scenario would relate to that .hdevtoolsrc feature, i.e. how do you expect precedence of compiler options?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions