Skip to content

Commit

Permalink
Add warnings to the cabal file
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
aspiwack committed Feb 11, 2022
1 parent 409c49f commit 18e7bdc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ set -e
export LANG="C.UTF-8"

stack build ormolu
cabal format
## We can't format cabal at the moment because `cabal format` inlines
## common stanzas, which is very much something that we don't want. See
## https://github.com/haskell/cabal/issues/5734
#
# cabal format
stack exec ormolu -- -m inplace $(find . -type f -name "*.hs-boot" -o -name "*.hs")
12 changes: 11 additions & 1 deletion linear-base.cabal
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cabal-version: >=1.10
cabal-version: 3.0
name: linear-base
version: 0.1.1
license: MIT
Expand All @@ -21,7 +21,13 @@ source-repository head
type: git
location: https://github.com/tweag/linear-base

common warnings
ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances
-- Additional warnings we may consider adding:
-- * -Wredundant-constraints : would need deactivating in the modules which use Nat

library
import: warnings
exposed-modules:
Control.Monad.IO.Class.Linear
Control.Functor.Linear
Expand Down Expand Up @@ -109,6 +115,7 @@ library
default-language: Haskell2010
ghc-options: -O
build-depends:

base >=4.15 && <5,
containers,
ghc-prim,
Expand All @@ -120,6 +127,7 @@ library
primitive

test-suite test
import: warnings
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: test
Expand Down Expand Up @@ -148,6 +156,7 @@ test-suite test
vector

test-suite examples
import: warnings
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: examples
Expand All @@ -174,6 +183,7 @@ test-suite examples
text

benchmark mutable-data
import: warnings
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: bench
Expand Down
2 changes: 1 addition & 1 deletion test/Test/Data/Mutable/Vector.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE LinearTypes #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-name-shadowing #-}
{-# OPTIONS_GHC -Wno-name-shadowing -Wno-incomplete-uni-patterns #-}

-- |
-- Tests for mutable vectors.
Expand Down

0 comments on commit 18e7bdc

Please sign in to comment.