diff options
author | Tom Smeding <tom@tomsmeding.com> | 2025-05-13 19:58:36 +0200 |
---|---|---|
committer | Tom Smeding <tom@tomsmeding.com> | 2025-05-13 20:08:03 +0200 |
commit | edffb586e99b4846d67c396e05f7adc13ac87cf4 (patch) | |
tree | ed138129bec32831d98af46aadc64c187951c01b | |
parent | bda0d3e9c1752d35488665ec19d39904f0dc4b49 (diff) |
Some constraints look redundant to GHC, but are not
-rw-r--r-- | ox-arrays.cabal | 10 | ||||
-rw-r--r-- | release-hints.txt | 2 | ||||
-rw-r--r-- | test/Gen.hs | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/ox-arrays.cabal b/ox-arrays.cabal index 2d45b08..c46e216 100644 --- a/ox-arrays.cabal +++ b/ox-arrays.cabal @@ -74,7 +74,7 @@ library hs-source-dirs: src default-language: Haskell2010 - ghc-options: -Wall -Wcompat -Widentities -Wredundant-constraints -Wunused-packages + ghc-options: -Wall -Wcompat -Widentities -Wunused-packages other-extensions: TemplateHaskell library strided-array-ops @@ -105,7 +105,7 @@ library strided-array-ops cc-options: -msse2 default-language: Haskell2010 - ghc-options: -Wall -Wcompat -Widentities -Wredundant-constraints -Wunused-packages + ghc-options: -Wall -Wcompat -Widentities -Wunused-packages other-extensions: TemplateHaskell test-suite test @@ -130,7 +130,7 @@ test-suite test vector hs-source-dirs: test default-language: Haskell2010 - ghc-options: -Wall -Wcompat -Widentities -Wredundant-constraints -Wunused-packages + ghc-options: -Wall -Wcompat -Widentities -Wunused-packages test-suite example type: exitcode-stdio-1.0 @@ -140,7 +140,7 @@ test-suite example base hs-source-dirs: example default-language: Haskell2010 - ghc-options: -Wall -Wcompat -Widentities -Wredundant-constraints -Wunused-packages + ghc-options: -Wall -Wcompat -Widentities -Wunused-packages benchmark bench type: exitcode-stdio-1.0 @@ -155,7 +155,7 @@ benchmark bench vector hs-source-dirs: bench default-language: Haskell2010 - ghc-options: -Wall -Wcompat -Widentities -Wredundant-constraints -Wunused-packages + ghc-options: -Wall -Wcompat -Widentities -Wunused-packages source-repository head type: git diff --git a/release-hints.txt b/release-hints.txt new file mode 100644 index 0000000..259c671 --- /dev/null +++ b/release-hints.txt @@ -0,0 +1,2 @@ +- Temporarily enable -Wredundant-constraints + - Has too many false-positives to enable normally, but sometimes catches actual redundant constraints diff --git a/test/Gen.hs b/test/Gen.hs index ae1d1f0..bf002ca 100644 --- a/test/Gen.hs +++ b/test/Gen.hs @@ -98,7 +98,7 @@ genReplicatedShR = \m n -> do (sh2, sh3) <- injectOnes n sh1 sh1 return (sh1, sh2, sh3) where - injectOnes :: SNat n -> IShR m -> IShR m -> Gen (IShR n, IShR n) + injectOnes :: m <= n => SNat n -> IShR m -> IShR m -> Gen (IShR n, IShR n) injectOnes n@SNat shOnes sh | m@SNat <- shrRank sh = case cmpNat n m of @@ -110,7 +110,7 @@ genReplicatedShR = \m n -> do Refl <- return (lem n m) injectOnes n (inject index 1 shOnes) (inject index value sh) - lem :: forall n m proxy. proxy n -> proxy m -> (m + 1 <=? n) :~: True + lem :: forall n m proxy. n > m => proxy n -> proxy m -> (m + 1 <=? n) :~: True lem _ _ = unsafeCoerceRefl inject :: Int -> Int -> IShR m -> IShR (m + 1) |