From 18e7bdc0c13b80c6176c89191f0f26f1c7724d17 Mon Sep 17 00:00:00 2001 From: Arnaud Spiwack Date: Fri, 11 Feb 2022 11:36:57 +0100 Subject: [PATCH] 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](https://github.com/haskell/cabal/issues/5734). --- format.sh | 6 +++++- linear-base.cabal | 12 +++++++++++- test/Test/Data/Mutable/Vector.hs | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/format.sh b/format.sh index adedcc36..24538b65 100755 --- a/format.sh +++ b/format.sh @@ -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") diff --git a/linear-base.cabal b/linear-base.cabal index 1a2dc88a..19d791cb 100644 --- a/linear-base.cabal +++ b/linear-base.cabal @@ -1,4 +1,4 @@ -cabal-version: >=1.10 +cabal-version: 3.0 name: linear-base version: 0.1.1 license: MIT @@ -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 @@ -109,6 +115,7 @@ library default-language: Haskell2010 ghc-options: -O build-depends: + base >=4.15 && <5, containers, ghc-prim, @@ -120,6 +127,7 @@ library primitive test-suite test + import: warnings type: exitcode-stdio-1.0 main-is: Main.hs hs-source-dirs: test @@ -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 @@ -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 diff --git a/test/Test/Data/Mutable/Vector.hs b/test/Test/Data/Mutable/Vector.hs index 949b35d8..cfd3c60b 100644 --- a/test/Test/Data/Mutable/Vector.hs +++ b/test/Test/Data/Mutable/Vector.hs @@ -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.