Skip to content

Commit 18e7bdc

Browse files
committed
Add warnings to the cabal file
This helps, in particular, when developping with ghcid, which otherwise doesn't raise warnings. I've had to deactivate `cabal` format in the formatting script due to the fact that it inlines `common` stanzas, which I'm using to ensure consistent warning settings in every target. See [haskell/cabal#5734](haskell/cabal#5734).
1 parent 409c49f commit 18e7bdc

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

format.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,9 @@ set -e
66
export LANG="C.UTF-8"
77

88
stack build ormolu
9-
cabal format
9+
## We can't format cabal at the moment because `cabal format` inlines
10+
## common stanzas, which is very much something that we don't want. See
11+
## https://github.com/haskell/cabal/issues/5734
12+
#
13+
# cabal format
1014
stack exec ormolu -- -m inplace $(find . -type f -name "*.hs-boot" -o -name "*.hs")

linear-base.cabal

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cabal-version: >=1.10
1+
cabal-version: 3.0
22
name: linear-base
33
version: 0.1.1
44
license: MIT
@@ -21,7 +21,13 @@ source-repository head
2121
type: git
2222
location: https://github.com/tweag/linear-base
2323

24+
common warnings
25+
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances
26+
-- Additional warnings we may consider adding:
27+
-- * -Wredundant-constraints : would need deactivating in the modules which use Nat
28+
2429
library
30+
import: warnings
2531
exposed-modules:
2632
Control.Monad.IO.Class.Linear
2733
Control.Functor.Linear
@@ -109,6 +115,7 @@ library
109115
default-language: Haskell2010
110116
ghc-options: -O
111117
build-depends:
118+
112119
base >=4.15 && <5,
113120
containers,
114121
ghc-prim,
@@ -120,6 +127,7 @@ library
120127
primitive
121128

122129
test-suite test
130+
import: warnings
123131
type: exitcode-stdio-1.0
124132
main-is: Main.hs
125133
hs-source-dirs: test
@@ -148,6 +156,7 @@ test-suite test
148156
vector
149157

150158
test-suite examples
159+
import: warnings
151160
type: exitcode-stdio-1.0
152161
main-is: Main.hs
153162
hs-source-dirs: examples
@@ -174,6 +183,7 @@ test-suite examples
174183
text
175184

176185
benchmark mutable-data
186+
import: warnings
177187
type: exitcode-stdio-1.0
178188
main-is: Main.hs
179189
hs-source-dirs: bench

test/Test/Data/Mutable/Vector.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{-# LANGUAGE LambdaCase #-}
33
{-# LANGUAGE LinearTypes #-}
44
{-# LANGUAGE OverloadedStrings #-}
5-
{-# OPTIONS_GHC -Wno-name-shadowing #-}
5+
{-# OPTIONS_GHC -Wno-name-shadowing -Wno-incomplete-uni-patterns #-}
66

77
-- |
88
-- Tests for mutable vectors.

0 commit comments

Comments
 (0)