Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stack : Error in $.flags._: key "manual" not present

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

like image 309
Ford O. Avatar asked Mar 31 '26 00:03

Ford O.


1 Answers

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.)

like image 171
hao Avatar answered Apr 02 '26 23:04

hao