Skip to content

Escaping of ghc-options with spaces #237

Description

@snoyberg

Consider the following cabal file:

name:           foo
version:        0.1.0.0
build-type:     Simple
cabal-version:  >= 1.10

executable foo
  main-is: Main.hs
  build-depends: base
  default-language: Haskell2010
  ghc-options: -threaded -O2 -rtsopts "-with-rtsopts=-N -T"

Using hpack-convert, I end up with:

name: foo
version: '0.1.0.0'
license: UnspecifiedLicense
ghc-options:
- -threaded
- -O2
- -rtsopts
- -with-rtsopts=-N -T
dependencies:
- base
executables:
  foo:
    main: Main.hs

Which results in the following in the generated cabal file:

  ghc-options: -threaded -O2 -rtsopts -with-rtsopts=-N -T

Unfortunately, this does not build:

ghc: unrecognised flag: -T
did you mean one of:
  -F
  -v
  -j

I can work around this by putting the following in my package.yaml instead of the list of options:

ghc-options: -threaded -O2 -rtsopts "-with-rtsopts=-N -T"

However, it would be nice to keep the list approach, and have hpack detect when there's a space in an option and automatically wrap it in quotes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions