Is there a way to put {-# LANGUAGE <feature> #-}
pragmas in either the:
<project>.cabal
, orstack.yaml
file, to avoid repeating the same header code in every *.hs file of a project?
As @user2407038 said in the comments, you can use the default-extensions
field in your <project>.cabal
file.
If you wanted to have OverloadStrings
and GADTs
in all of your modules in the project, you would list it in relevant section of your cabal file (i.e. if you want it for all of your library files, put it in library).
For example:
-- <project>.cabal
...
library
hs-source-dirs: src
default-extensions: GADTs
, OverloadedStrings
...
If you are using a package.yaml
configuration file to generate your <project>.cabal
file, you can also specify this field there.
-- package.yaml
library:
source-dirs: src
default-extensions:
- OverloadedStrings
- GADTs
exposed-modules:
- MyModule
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With