Reputation: 1498
I tried to add flag to package.yaml
file
name: sandbox
version: 0.1.0.0
homepage: https://github.com/githubuser/sandbox#readme
license: BSD3
author: Author name here
maintainer: [email protected]
copyright: 2017 Author name here
category: Web
extra-source-files:
- README.md
flags :
sandbox:
defer-type-errors : true
dependencies:
- base >= 4.7 && < 5
executables:
sandbox:
source-dirs: src
main: Main.hs
dependencies : streaming
But I get following error :
....\sandbox\package.yaml: Error in $.flags.sandbox: key "manual" not present
Upvotes: 3
Views: 194
Reputation: 10238
To tun on type-error deferral, teach Stack to compile with the flag inside stack.yaml, not package.yaml:
resolver: ...
packages: ['.']
ghc-options:
sandbox: -fdefer-type-errors
extra-deps: []
flags: {}
extra-package-dbs: []
The flags
paragraph in package.yaml is meant to declare flags for users of your package to turn on or off. See here for an example. This is typically used for conditional compilation of optional features, like integration tests.
To adjust the flags GHC will use at compiletime, use ghc-options
in stack.yaml. (Confusingly enough, there is also a flags
in stack.yaml
.)
Upvotes: 1
Reputation: 16214
If this is the whole file, you must add (if you're using ghc-8.0.2) :
resolver: lts-8.3
flags:
sandbox:
defer-type-errors: true
Name is not necesary.
Upvotes: 0