From 201a1b96824211ab6edbc452fc5558f252c971a0 Mon Sep 17 00:00:00 2001 From: Erik de Castro Lopo Date: Fri, 19 Jul 2024 10:34:45 +1000 Subject: [PATCH] Make it build with ghc 9.10 (#1536) * Make it build with ghc 9.10 * CI: Add ghc-9.10 to the build matrix --- .github/workflows/haskell.yml | 7 ++++--- cabal.project | 1 + persistent-mongoDB/Database/Persist/MongoDB.hs | 1 + persistent-mongoDB/test/EmbedTestMongo.hs | 1 + persistent-mongoDB/test/main.hs | 1 + persistent-mysql/Database/Persist/MySQL.hs | 1 + persistent-mysql/test/InsertDuplicateUpdate.hs | 1 + persistent-mysql/test/main.hs | 1 + .../Database/Persist/Postgresql.hs | 5 +++-- persistent-postgresql/test/ArrayAggTest.hs | 1 + .../test/EquivalentTypeTestPostgres.hs | 1 + persistent-postgresql/test/ImplicitUuidSpec.hs | 1 + persistent-postgresql/test/PgIntervalTest.hs | 1 + persistent-postgresql/test/UpsertWhere.hs | 1 + persistent-postgresql/test/main.hs | 1 + persistent-redis/persistent-redis.cabal | 2 +- persistent-redis/tests/basic-test.hs | 1 + persistent-sqlite/test/main.hs | 1 + persistent-test/src/CompositeTest.hs | 1 + persistent-test/src/CustomPersistFieldTest.hs | 1 + .../src/CustomPrimaryKeyReferenceTest.hs | 1 + persistent-test/src/DataTypeTest.hs | 1 + persistent-test/src/EmbedOrderTest.hs | 1 + persistent-test/src/EmbedTest.hs | 1 + persistent-test/src/EmptyEntityTest.hs | 1 + persistent-test/src/EntityEmbedTest.hs | 1 + persistent-test/src/EquivalentTypeTest.hs | 1 + persistent-test/src/ForeignKey.hs | 1 + persistent-test/src/GeneratedColumnTestSQL.hs | 1 + persistent-test/src/HtmlTest.hs | 1 + persistent-test/src/Init.hs | 1 + persistent-test/src/LargeNumberTest.hs | 1 + persistent-test/src/LongIdentifierTest.hs | 1 + persistent-test/src/MaxLenTest.hs | 1 + persistent-test/src/MaybeFieldDefsTest.hs | 1 + persistent-test/src/MigrationColumnLengthTest.hs | 1 + persistent-test/src/MigrationIdempotencyTest.hs | 1 + persistent-test/src/MigrationOnlyTest.hs | 2 +- persistent-test/src/MigrationTest.hs | 1 + persistent-test/src/PersistUniqueTest.hs | 1 + persistent-test/src/PersistentTest.hs | 1 + persistent-test/src/PersistentTestModels.hs | 1 + .../src/PersistentTestModelsImports.hs | 1 + persistent-test/src/PrimaryTest.hs | 1 + persistent-test/src/RawSqlTest.hs | 1 + persistent-test/src/Recursive.hs | 1 + persistent-test/src/RenameTest.hs | 2 +- persistent-test/src/SumTypeTest.hs | 1 + persistent-test/src/TransactionLevelTest.hs | 1 + persistent-test/src/TreeTest.hs | 2 +- persistent-test/src/TypeLitFieldDefsTest.hs | 1 + persistent-test/src/UniqueTest.hs | 1 + .../Database/Persist/Class/PersistConfig.hs | 1 + persistent/Database/Persist/Class/PersistStore.hs | 1 + .../Database/Persist/ImplicitIdDef/Internal.hs | 3 ++- .../Database/Persist/Sql/Orphan/PersistQuery.hs | 1 + .../Database/Persist/Sql/Orphan/PersistStore.hs | 1 + persistent/Database/Persist/Sql/Types/Internal.hs | 1 + persistent/Database/Persist/TH.hs | 15 +++++++-------- persistent/bench/Main.hs | 4 ++++ persistent/persistent.cabal | 2 +- 61 files changed, 76 insertions(+), 19 deletions(-) diff --git a/.github/workflows/haskell.yml b/.github/workflows/haskell.yml index e3efaf2e8..4bdab79f1 100644 --- a/.github/workflows/haskell.yml +++ b/.github/workflows/haskell.yml @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - cabal: ["3.8"] + cabal: ["3.10"] ghc: - "8.4.4" - "8.6.5" @@ -54,9 +54,10 @@ jobs: - "9.0.2" - "9.2.7" - "9.4.5" + - "9.6.5" include: - - ghc: "9.6.1" - cabal: "3.10" + - ghc: "9.10.1" + cabal: "3.12" env: CONFIG: "--enable-tests --enable-benchmarks" diff --git a/cabal.project b/cabal.project index 447eb5faa..53ef4460b 100644 --- a/cabal.project +++ b/cabal.project @@ -17,6 +17,7 @@ constraints: -- These need hackage revisions but otherwise test fine in the repo allow-newer: -- https://github.com/haskellari/postgresql-simple/pull/95 + -- https://github.com/haskellari/postgresql-simple/issues/139 , postgresql-simple:base , postgresql-simple:template-haskell diff --git a/persistent-mongoDB/Database/Persist/MongoDB.hs b/persistent-mongoDB/Database/Persist/MongoDB.hs index f85dbc945..d232fea10 100644 --- a/persistent-mongoDB/Database/Persist/MongoDB.hs +++ b/persistent-mongoDB/Database/Persist/MongoDB.hs @@ -6,6 +6,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-orphans #-} {-# OPTIONS_GHC -fno-warn-deprecations #-} -- Pattern match 'PersistDbSpecific' -- | Use persistent-mongodb the same way you would use other persistent diff --git a/persistent-mongoDB/test/EmbedTestMongo.hs b/persistent-mongoDB/test/EmbedTestMongo.hs index 79643a359..7299ab56d 100644 --- a/persistent-mongoDB/test/EmbedTestMongo.hs +++ b/persistent-mongoDB/test/EmbedTestMongo.hs @@ -10,6 +10,7 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -Wno-unused-top-binds -Wno-orphans -O0 #-} module EmbedTestMongo (specs) where diff --git a/persistent-mongoDB/test/main.hs b/persistent-mongoDB/test/main.hs index f35faddb0..bbe9f804b 100644 --- a/persistent-mongoDB/test/main.hs +++ b/persistent-mongoDB/test/main.hs @@ -10,6 +10,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-mysql/Database/Persist/MySQL.hs b/persistent-mysql/Database/Persist/MySQL.hs index 73f0a1ded..249b739e7 100644 --- a/persistent-mysql/Database/Persist/MySQL.hs +++ b/persistent-mysql/Database/Persist/MySQL.hs @@ -7,6 +7,7 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE ViewPatterns #-} {-# OPTIONS_GHC -fno-warn-deprecations #-} -- Pattern match 'PersistDbSpecific' diff --git a/persistent-mysql/test/InsertDuplicateUpdate.hs b/persistent-mysql/test/InsertDuplicateUpdate.hs index 437120792..bcff87e4e 100644 --- a/persistent-mysql/test/InsertDuplicateUpdate.hs +++ b/persistent-mysql/test/InsertDuplicateUpdate.hs @@ -7,6 +7,7 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeOperators #-} module InsertDuplicateUpdate where diff --git a/persistent-mysql/test/main.hs b/persistent-mysql/test/main.hs index f5c95b0c4..4eeed768e 100644 --- a/persistent-mysql/test/main.hs +++ b/persistent-mysql/test/main.hs @@ -10,6 +10,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-postgresql/Database/Persist/Postgresql.hs b/persistent-postgresql/Database/Persist/Postgresql.hs index dc97abdbc..a34aafda6 100644 --- a/persistent-postgresql/Database/Persist/Postgresql.hs +++ b/persistent-postgresql/Database/Persist/Postgresql.hs @@ -13,6 +13,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE ViewPatterns #-} #if MIN_VERSION_base(4,12,0) @@ -107,7 +108,7 @@ import Data.Either (partitionEithers) import Data.Function (on) import Data.Int (Int64) import Data.IORef -import Data.List (find, foldl', groupBy, sort) +import Data.List as List (find, foldl', groupBy, sort) import qualified Data.List as List import Data.List.NonEmpty (NonEmpty) import qualified Data.Map as Map @@ -845,7 +846,7 @@ getColumns getter def cols = do refMap = fmap (\cr -> (crTableName cr, crConstraintName cr)) $ Map.fromList - $ foldl' ref [] cols + $ List.foldl' ref [] cols where ref rs c = maybe rs (\r -> (unFieldNameDB $ cName c, r) : rs) (cReference c) diff --git a/persistent-postgresql/test/ArrayAggTest.hs b/persistent-postgresql/test/ArrayAggTest.hs index b8902a114..ac1f6e42d 100644 --- a/persistent-postgresql/test/ArrayAggTest.hs +++ b/persistent-postgresql/test/ArrayAggTest.hs @@ -6,6 +6,7 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -- FIXME {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DerivingStrategies #-} diff --git a/persistent-postgresql/test/EquivalentTypeTestPostgres.hs b/persistent-postgresql/test/EquivalentTypeTestPostgres.hs index b23c3606a..1e1650bf7 100644 --- a/persistent-postgresql/test/EquivalentTypeTestPostgres.hs +++ b/persistent-postgresql/test/EquivalentTypeTestPostgres.hs @@ -9,6 +9,7 @@ {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module EquivalentTypeTestPostgres (specs) where diff --git a/persistent-postgresql/test/ImplicitUuidSpec.hs b/persistent-postgresql/test/ImplicitUuidSpec.hs index 68f5fd587..f0dbd361a 100644 --- a/persistent-postgresql/test/ImplicitUuidSpec.hs +++ b/persistent-postgresql/test/ImplicitUuidSpec.hs @@ -10,6 +10,7 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module ImplicitUuidSpec where diff --git a/persistent-postgresql/test/PgIntervalTest.hs b/persistent-postgresql/test/PgIntervalTest.hs index 626d386fb..18ed2e516 100644 --- a/persistent-postgresql/test/PgIntervalTest.hs +++ b/persistent-postgresql/test/PgIntervalTest.hs @@ -11,6 +11,7 @@ {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE TypeOperators #-} module PgIntervalTest where diff --git a/persistent-postgresql/test/UpsertWhere.hs b/persistent-postgresql/test/UpsertWhere.hs index 433fac1e0..3c74a5843 100644 --- a/persistent-postgresql/test/UpsertWhere.hs +++ b/persistent-postgresql/test/UpsertWhere.hs @@ -10,6 +10,7 @@ {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module UpsertWhere where diff --git a/persistent-postgresql/test/main.hs b/persistent-postgresql/test/main.hs index c00650ac0..10a726623 100644 --- a/persistent-postgresql/test/main.hs +++ b/persistent-postgresql/test/main.hs @@ -9,6 +9,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-redis/persistent-redis.cabal b/persistent-redis/persistent-redis.cabal index 6d3f609ce..c51defd47 100644 --- a/persistent-redis/persistent-redis.cabal +++ b/persistent-redis/persistent-redis.cabal @@ -21,7 +21,7 @@ library , persistent >= 2.12 && < 3.0 , aeson >= 1.0 , binary >= 0.8 && < 0.9 - , bytestring >= 0.10.8 && < 0.12 + , bytestring >= 0.10.8 && < 0.13 , hedis >= 0.9 , http-api-data , mtl >= 2.2.1 && < 2.4 diff --git a/persistent-redis/tests/basic-test.hs b/persistent-redis/tests/basic-test.hs index da3d6196c..a57593059 100644 --- a/persistent-redis/tests/basic-test.hs +++ b/persistent-redis/tests/basic-test.hs @@ -8,6 +8,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE UndecidableInstances #-} module Main where diff --git a/persistent-sqlite/test/main.hs b/persistent-sqlite/test/main.hs index f8a7a87ea..96234efcd 100644 --- a/persistent-sqlite/test/main.hs +++ b/persistent-sqlite/test/main.hs @@ -12,6 +12,7 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-unused-top-binds #-} diff --git a/persistent-test/src/CompositeTest.hs b/persistent-test/src/CompositeTest.hs index 2ec18f726..89f5d0745 100644 --- a/persistent-test/src/CompositeTest.hs +++ b/persistent-test/src/CompositeTest.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -- FIXME {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} module CompositeTest where diff --git a/persistent-test/src/CustomPersistFieldTest.hs b/persistent-test/src/CustomPersistFieldTest.hs index 211524924..630bf5bfa 100644 --- a/persistent-test/src/CustomPersistFieldTest.hs +++ b/persistent-test/src/CustomPersistFieldTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module CustomPersistFieldTest (specsWith, customFieldMigrate) where diff --git a/persistent-test/src/CustomPrimaryKeyReferenceTest.hs b/persistent-test/src/CustomPrimaryKeyReferenceTest.hs index 2bfcb8251..1ba6a4fde 100644 --- a/persistent-test/src/CustomPrimaryKeyReferenceTest.hs +++ b/persistent-test/src/CustomPrimaryKeyReferenceTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -- This test is based on this issue: https://github.com/yesodweb/persistent/issues/421 -- The primary thing this is testing is the migration, thus the test code itself being mostly negligible. diff --git a/persistent-test/src/DataTypeTest.hs b/persistent-test/src/DataTypeTest.hs index 39d3ef068..5d7a5fd0d 100644 --- a/persistent-test/src/DataTypeTest.hs +++ b/persistent-test/src/DataTypeTest.hs @@ -1,5 +1,6 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module DataTypeTest ( specsWith diff --git a/persistent-test/src/EmbedOrderTest.hs b/persistent-test/src/EmbedOrderTest.hs index 7fdc0ffad..32db2c90c 100644 --- a/persistent-test/src/EmbedOrderTest.hs +++ b/persistent-test/src/EmbedOrderTest.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module EmbedOrderTest (specsWith, embedOrderMigrate, cleanDB) where diff --git a/persistent-test/src/EmbedTest.hs b/persistent-test/src/EmbedTest.hs index 387c4813d..cde89737d 100644 --- a/persistent-test/src/EmbedTest.hs +++ b/persistent-test/src/EmbedTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-orphans -O0 #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module EmbedTest (specsWith, cleanDB, embedMigrate) where diff --git a/persistent-test/src/EmptyEntityTest.hs b/persistent-test/src/EmptyEntityTest.hs index 5d307f9d5..e9f52c1a1 100644 --- a/persistent-test/src/EmptyEntityTest.hs +++ b/persistent-test/src/EmptyEntityTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module EmptyEntityTest (specsWith, migration, cleanDB) where diff --git a/persistent-test/src/EntityEmbedTest.hs b/persistent-test/src/EntityEmbedTest.hs index f29ad9622..683459b5e 100644 --- a/persistent-test/src/EntityEmbedTest.hs +++ b/persistent-test/src/EntityEmbedTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} module EntityEmbedTest where -- because we are using a type alias we need to declare in a separate module diff --git a/persistent-test/src/EquivalentTypeTest.hs b/persistent-test/src/EquivalentTypeTest.hs index b2267c690..abb246ea8 100644 --- a/persistent-test/src/EquivalentTypeTest.hs +++ b/persistent-test/src/EquivalentTypeTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-test/src/ForeignKey.hs b/persistent-test/src/ForeignKey.hs index fa1250604..42e3d2033 100644 --- a/persistent-test/src/ForeignKey.hs +++ b/persistent-test/src/ForeignKey.hs @@ -1,6 +1,7 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE AllowAmbiguousTypes, GeneralizedNewtypeDeriving #-} {-# LANGUAGE ScopedTypeVariables, TypeApplications, UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} module ForeignKey where diff --git a/persistent-test/src/GeneratedColumnTestSQL.hs b/persistent-test/src/GeneratedColumnTestSQL.hs index 2eac96d5a..f18701f47 100644 --- a/persistent-test/src/GeneratedColumnTestSQL.hs +++ b/persistent-test/src/GeneratedColumnTestSQL.hs @@ -1,4 +1,5 @@ {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module GeneratedColumnTestSQL (specsWith) where diff --git a/persistent-test/src/HtmlTest.hs b/persistent-test/src/HtmlTest.hs index f5f36ff1b..7430c164b 100644 --- a/persistent-test/src/HtmlTest.hs +++ b/persistent-test/src/HtmlTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DataKinds, UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module HtmlTest (specsWith, cleanDB, htmlMigrate) where diff --git a/persistent-test/src/Init.hs b/persistent-test/src/Init.hs index fce045e60..7e6047864 100644 --- a/persistent-test/src/Init.hs +++ b/persistent-test/src/Init.hs @@ -3,6 +3,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} diff --git a/persistent-test/src/LargeNumberTest.hs b/persistent-test/src/LargeNumberTest.hs index a59f29779..c80559d30 100644 --- a/persistent-test/src/LargeNumberTest.hs +++ b/persistent-test/src/LargeNumberTest.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module LargeNumberTest where diff --git a/persistent-test/src/LongIdentifierTest.hs b/persistent-test/src/LongIdentifierTest.hs index 85a6abf22..f9c2fc089 100644 --- a/persistent-test/src/LongIdentifierTest.hs +++ b/persistent-test/src/LongIdentifierTest.hs @@ -9,6 +9,7 @@ {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module LongIdentifierTest where diff --git a/persistent-test/src/MaxLenTest.hs b/persistent-test/src/MaxLenTest.hs index 917b12138..979efe8b2 100644 --- a/persistent-test/src/MaxLenTest.hs +++ b/persistent-test/src/MaxLenTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module MaxLenTest (specsWith, maxlenMigrate) where diff --git a/persistent-test/src/MaybeFieldDefsTest.hs b/persistent-test/src/MaybeFieldDefsTest.hs index 9242ba4b7..e4609081e 100644 --- a/persistent-test/src/MaybeFieldDefsTest.hs +++ b/persistent-test/src/MaybeFieldDefsTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-test/src/MigrationColumnLengthTest.hs b/persistent-test/src/MigrationColumnLengthTest.hs index ac5ffed89..051646cd7 100644 --- a/persistent-test/src/MigrationColumnLengthTest.hs +++ b/persistent-test/src/MigrationColumnLengthTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module MigrationColumnLengthTest where diff --git a/persistent-test/src/MigrationIdempotencyTest.hs b/persistent-test/src/MigrationIdempotencyTest.hs index 17766e6d1..3f58d14e7 100644 --- a/persistent-test/src/MigrationIdempotencyTest.hs +++ b/persistent-test/src/MigrationIdempotencyTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module MigrationIdempotencyTest where diff --git a/persistent-test/src/MigrationOnlyTest.hs b/persistent-test/src/MigrationOnlyTest.hs index 850f2aec8..880a7b959 100644 --- a/persistent-test/src/MigrationOnlyTest.hs +++ b/persistent-test/src/MigrationOnlyTest.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeApplications, UndecidableInstances #-} +{-# LANGUAGE TypeApplications, TypeOperators, UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-test/src/MigrationTest.hs b/persistent-test/src/MigrationTest.hs index 7ee8255e0..cd431c667 100644 --- a/persistent-test/src/MigrationTest.hs +++ b/persistent-test/src/MigrationTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module MigrationTest where diff --git a/persistent-test/src/PersistUniqueTest.hs b/persistent-test/src/PersistUniqueTest.hs index be7ceaf14..008580ca5 100644 --- a/persistent-test/src/PersistUniqueTest.hs +++ b/persistent-test/src/PersistUniqueTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module PersistUniqueTest where diff --git a/persistent-test/src/PersistentTest.hs b/persistent-test/src/PersistentTest.hs index 597511389..71e0c5b0c 100644 --- a/persistent-test/src/PersistentTest.hs +++ b/persistent-test/src/PersistentTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE RecordWildCards, UndecidableInstances #-} module PersistentTest diff --git a/persistent-test/src/PersistentTestModels.hs b/persistent-test/src/PersistentTestModels.hs index bced3af7e..8e953025c 100644 --- a/persistent-test/src/PersistentTestModels.hs +++ b/persistent-test/src/PersistentTestModels.hs @@ -1,6 +1,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} -- FIXME {-# OPTIONS_GHC -ddump-splices #-} diff --git a/persistent-test/src/PersistentTestModelsImports.hs b/persistent-test/src/PersistentTestModelsImports.hs index c364a09c0..94b9d3e1a 100644 --- a/persistent-test/src/PersistentTestModelsImports.hs +++ b/persistent-test/src/PersistentTestModelsImports.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE TypeOperators #-} {-# language UndecidableInstances #-} -- | this just needs to compile diff --git a/persistent-test/src/PrimaryTest.hs b/persistent-test/src/PrimaryTest.hs index 266bed235..420814118 100644 --- a/persistent-test/src/PrimaryTest.hs +++ b/persistent-test/src/PrimaryTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DeriveGeneric #-} diff --git a/persistent-test/src/RawSqlTest.hs b/persistent-test/src/RawSqlTest.hs index a88946bd6..1dd9fde24 100644 --- a/persistent-test/src/RawSqlTest.hs +++ b/persistent-test/src/RawSqlTest.hs @@ -1,4 +1,5 @@ {-# language ScopedTypeVariables, DataKinds #-} +{-# LANGUAGE TypeOperators #-} module RawSqlTest where diff --git a/persistent-test/src/Recursive.hs b/persistent-test/src/Recursive.hs index 1991692b4..c82b8fcf7 100644 --- a/persistent-test/src/Recursive.hs +++ b/persistent-test/src/Recursive.hs @@ -1,4 +1,5 @@ {-# LANGUAGE UndecidableInstances #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-test/src/RenameTest.hs b/persistent-test/src/RenameTest.hs index 051497b8e..ab7f9c873 100644 --- a/persistent-test/src/RenameTest.hs +++ b/persistent-test/src/RenameTest.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeApplications, UndecidableInstances #-} +{-# LANGUAGE TypeApplications, TypeOperators, UndecidableInstances #-} module RenameTest where diff --git a/persistent-test/src/SumTypeTest.hs b/persistent-test/src/SumTypeTest.hs index 79ae5f07e..750f370ea 100644 --- a/persistent-test/src/SumTypeTest.hs +++ b/persistent-test/src/SumTypeTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} module SumTypeTest (specsWith, sumTypeMigrate) where diff --git a/persistent-test/src/TransactionLevelTest.hs b/persistent-test/src/TransactionLevelTest.hs index 32ee36d9b..c9a5c621d 100644 --- a/persistent-test/src/TransactionLevelTest.hs +++ b/persistent-test/src/TransactionLevelTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module TransactionLevelTest where diff --git a/persistent-test/src/TreeTest.hs b/persistent-test/src/TreeTest.hs index ce14f5c7c..28cfe9087 100644 --- a/persistent-test/src/TreeTest.hs +++ b/persistent-test/src/TreeTest.hs @@ -1,5 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE RecordWildCards, UndecidableInstances #-} +{-# LANGUAGE RecordWildCards, TypeOperators, UndecidableInstances #-} module TreeTest where diff --git a/persistent-test/src/TypeLitFieldDefsTest.hs b/persistent-test/src/TypeLitFieldDefsTest.hs index 263ccc668..1bc5f5afc 100644 --- a/persistent-test/src/TypeLitFieldDefsTest.hs +++ b/persistent-test/src/TypeLitFieldDefsTest.hs @@ -1,5 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-unused-top-binds #-} diff --git a/persistent-test/src/UniqueTest.hs b/persistent-test/src/UniqueTest.hs index a9beb1f57..8eaf94a93 100644 --- a/persistent-test/src/UniqueTest.hs +++ b/persistent-test/src/UniqueTest.hs @@ -1,4 +1,5 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module UniqueTest where diff --git a/persistent/Database/Persist/Class/PersistConfig.hs b/persistent/Database/Persist/Class/PersistConfig.hs index df225c8ad..7182e4007 100644 --- a/persistent/Database/Persist/Class/PersistConfig.hs +++ b/persistent/Database/Persist/Class/PersistConfig.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE TypeOperators #-} module Database.Persist.Class.PersistConfig ( PersistConfig (..) diff --git a/persistent/Database/Persist/Class/PersistStore.hs b/persistent/Database/Persist/Class/PersistStore.hs index 85b9eab40..19e97daad 100644 --- a/persistent/Database/Persist/Class/PersistStore.hs +++ b/persistent/Database/Persist/Class/PersistStore.hs @@ -1,5 +1,6 @@ {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ExplicitForAll #-} +{-# LANGUAGE TypeOperators #-} module Database.Persist.Class.PersistStore ( HasPersistBackend (..) , withBaseBackend diff --git a/persistent/Database/Persist/ImplicitIdDef/Internal.hs b/persistent/Database/Persist/ImplicitIdDef/Internal.hs index 1aa002e40..909ef61f0 100644 --- a/persistent/Database/Persist/ImplicitIdDef/Internal.hs +++ b/persistent/Database/Persist/ImplicitIdDef/Internal.hs @@ -4,7 +4,8 @@ {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TypeApplications #-} -{-# LANGUAGE TypeInType #-} +{-# LANGUAGE PolyKinds #-} +{-# LANGUAGE TypeOperators #-} -- | WARNING: This is an @Internal@ module. As such, breaking changes to the API -- of this module will not have a corresponding major version bump. diff --git a/persistent/Database/Persist/Sql/Orphan/PersistQuery.hs b/persistent/Database/Persist/Sql/Orphan/PersistQuery.hs index fde6c2a45..77c169cd8 100644 --- a/persistent/Database/Persist/Sql/Orphan/PersistQuery.hs +++ b/persistent/Database/Persist/Sql/Orphan/PersistQuery.hs @@ -1,5 +1,6 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-orphans #-} diff --git a/persistent/Database/Persist/Sql/Orphan/PersistStore.hs b/persistent/Database/Persist/Sql/Orphan/PersistStore.hs index ce89b8f2c..01b9e4d6f 100644 --- a/persistent/Database/Persist/Sql/Orphan/PersistStore.hs +++ b/persistent/Database/Persist/Sql/Orphan/PersistStore.hs @@ -2,6 +2,7 @@ {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-orphans #-} diff --git a/persistent/Database/Persist/Sql/Types/Internal.hs b/persistent/Database/Persist/Sql/Types/Internal.hs index f515c863c..a3830d779 100644 --- a/persistent/Database/Persist/Sql/Types/Internal.hs +++ b/persistent/Database/Persist/Sql/Types/Internal.hs @@ -2,6 +2,7 @@ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TypeOperators #-} -- | Breaking changes to this module are not reflected in the major version -- number. Prefer to import from "Database.Persist.Sql" instead. If you neeed diff --git a/persistent/Database/Persist/TH.hs b/persistent/Database/Persist/TH.hs index f4b0bde24..eaa5e5595 100644 --- a/persistent/Database/Persist/TH.hs +++ b/persistent/Database/Persist/TH.hs @@ -101,7 +101,6 @@ import Data.Either import qualified Data.HashMap.Strict as HM import Data.Int (Int64) import Data.Ix (Ix) -import Data.List (foldl') import qualified Data.List as List import Data.List.NonEmpty (NonEmpty(..)) import qualified Data.List.NonEmpty as NEL @@ -1986,7 +1985,7 @@ fromValues entDef funName constructExpr fields = do return $ normalClause [ListP $ fmap VarP (x1:restNames)] - (foldl' (\exp (name, fpv) -> applyFromPersistValue fpv exp name) conApp (zip restNames mkPersistValues)) + (List.foldl' (\exp (name, fpv) -> applyFromPersistValue fpv exp name) conApp (zip restNames mkPersistValues)) infixFromPersistValue applyE fpv exp name = UInfixE exp applyE (fpv `AppE` VarE name) @@ -2061,7 +2060,7 @@ mkEntity embedEntityMap entityMap mps preDef = do let keyCon = keyConName entDef constr = - foldl' + List.foldl' AppE (ConE keyCon) (VarE . snd <$> keyFieldNames') @@ -2475,7 +2474,7 @@ mkForeignKeysComposite mps entDef foreignDef $ foreignFieldNames $ unboundForeignFields foreignDef mkKeyE = - foldl' AppE (maybeExp fNullable $ ConE reftableKeyName) fldsE + List.foldl' AppE (maybeExp fNullable $ ConE reftableKeyName) fldsE fn = FunD fname [normalClause [VarP recordVarName] mkKeyE] @@ -2630,7 +2629,7 @@ mkUniqueKeys def = do go :: [(FieldNameHS, Name)] -> UniqueDef -> Exp go xs (UniqueDef name _ cols _) = - foldl' (go' xs) (ConE (mkConstraintName name)) (toList $ fmap fst cols) + List.foldl' (go' xs) (ConE (mkConstraintName name)) (toList $ fmap fst cols) go' :: [(FieldNameHS, Name)] -> Exp -> FieldNameHS -> Exp go' xs front col = @@ -2953,7 +2952,7 @@ mkJSON mps (fixEntityDef -> def) = do FunD 'parseJSON [ normalClause [] parseJSONBody ] decoderImpl = LamE [VarP obj] - (foldl' + (List.foldl' (\x y -> InfixE (Just x) apE' (Just y)) (pureE `AppE` ConE conName) pulls @@ -2986,10 +2985,10 @@ mkJSON mps (fixEntityDef -> def) = do return $ toJSONI : fromJSONI : entityJSONIs mkClassP :: Name -> [Type] -> Pred -mkClassP cla tys = foldl AppT (ConT cla) tys +mkClassP cla tys = List.foldl AppT (ConT cla) tys mkEqualP :: Type -> Type -> Pred -mkEqualP tleft tright = foldl AppT EqualityT [tleft, tright] +mkEqualP tleft tright = List.foldl AppT EqualityT [tleft, tright] notStrict :: Bang notStrict = Bang NoSourceUnpackedness NoSourceStrictness diff --git a/persistent/bench/Main.hs b/persistent/bench/Main.hs index 4f194fdfc..646549b7b 100644 --- a/persistent/bench/Main.hs +++ b/persistent/bench/Main.hs @@ -129,7 +129,11 @@ instance NFData DerivStrategy where instance NFData DerivClause where +#endif +#if MIN_VERSION_template_haskell(2,22,0) +instance NFData BndrVis where +instance NFData NamespaceSpecifier where #endif instance NFData Con where diff --git a/persistent/persistent.cabal b/persistent/persistent.cabal index e50010262..1a72eb764 100644 --- a/persistent/persistent.cabal +++ b/persistent/persistent.cabal @@ -36,7 +36,7 @@ library , resourcet >= 1.1.10 , scientific , silently - , template-haskell >= 2.13 && < 2.22 + , template-haskell >= 2.13 && < 2.23 , text >= 1.2 , th-lift-instances >= 0.1.14 && < 0.2 , time >= 1.6