haskell-servant / servant

Main repository for the servant libraries — DSL for describing, serving, querying, mocking, documenting web applications and more!
https://docs.servant.dev/
1.8k stars 407 forks source link

Add -XTypeOperators #1713

Closed philderbeast closed 8 months ago

philderbeast commented 8 months ago

See #1681. Adds LANGUAGE TypeOperators where warned that this will be needed, such as:

$ cabal build all --enable-tests --enable-benchmarks
Resolving dependencies...
Build profile: -w ghc-9.4.7 -O0
...
src/Servant/Types/SourceT.hs:73:19: warning: [-Wtype-equality-requires-operators]
    The use of ‘~’ without TypeOperators
    will become an error in a future GHC release.
    Suggested fix: Perhaps you intended to use TypeOperators
   |
73 | instance Identity ~ m => Foldable (SourceT m) where
   |  

Can be tested by doing a rebuild from clean with this warning as an error:

$ git diff
diff --git a/cabal.project b/cabal.project
index 2239b77c..888f4689 100644
--- a/cabal.project
+++ b/cabal.project
@@ -77,3 +77,6 @@ if(impl(ghc >= 9.6.1))
 allow-newer: servant-multipart:servant, servant-multipart:servant-server, servant-multipart-api:servant
 allow-newer: servant-pagination:servant, servant-pagination:servant-server
 allow-newer: servant-js:servant, servant-js:servant-foreign
+
+program-options
+  ghc-options: -Werror=type-equality-requires-operators
\ No newline at end of file