From 957bf7f059409a2565d260218ff2aac80f165250 Mon Sep 17 00:00:00 2001 From: Christopher Reichert Date: Fri, 20 Mar 2026 11:21:27 -0500 Subject: [PATCH] Update fork to support ghc9/lts-22+ --- postgresql-simple-migration.cabal | 24 +++++++++++---------- src/Database/PostgreSQL/Simple/Migration.hs | 16 ++++++-------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/postgresql-simple-migration.cabal b/postgresql-simple-migration.cabal index f56dafc..e27c8f0 100644 --- a/postgresql-simple-migration.cabal +++ b/postgresql-simple-migration.cabal @@ -38,27 +38,29 @@ Library default-extensions: OverloadedStrings, CPP, LambdaCase default-language: Haskell2010 build-depends: base >= 4.6 && < 5.0, - base64-bytestring >= 1.0 && < 1.1, - bytestring >= 0.10 && < 0.11, + base64-bytestring >= 1.0 && < 1.3, + bytestring >= 0.10 && < 0.12, cryptohash >= 0.11 && < 0.12, directory >= 1.2 && < 1.4, - postgresql-simple >= 0.4 && < 0.7, - time >= 1.4 && < 1.10 + postgresql-simple >= 0.4 && < 0.8, + time >= 1.4 && < 1.13 Executable migrate main-is: Main.hs + other-modules: Database.PostgreSQL.Simple.Migration + Database.PostgreSQL.Simple.Util hs-source-dirs: src ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns default-extensions: OverloadedStrings, CPP, LambdaCase default-language: Haskell2010 build-depends: base >= 4.6 && < 5.0, - base64-bytestring >= 1.0 && < 1.1, - bytestring >= 0.10 && < 0.11, + base64-bytestring >= 1.0 && < 1.3, + bytestring >= 0.10 && < 0.12, cryptohash >= 0.11 && < 0.12, directory >= 1.2 && < 1.4, - postgresql-simple >= 0.4 && < 0.7, - time >= 1.4 && < 1.10, - text >= 1.2 && < 1.3 + postgresql-simple >= 0.4 && < 0.8, + time >= 1.4 && < 1.13, + text >= 1.2 && < 2.1 test-suite tests main-is: Main.hs @@ -69,7 +71,7 @@ test-suite tests default-language: Haskell2010 type: exitcode-stdio-1.0 build-depends: base >= 4.6 && < 5.0, - bytestring >= 0.10 && < 0.11, - postgresql-simple >= 0.4 && < 0.7, + bytestring >= 0.10 && < 0.12, + postgresql-simple >= 0.4 && < 0.8, hspec >= 2.2 && < 2.8, postgresql-simple-migration diff --git a/src/Database/PostgreSQL/Simple/Migration.hs b/src/Database/PostgreSQL/Simple/Migration.hs index cb6ece0..55df315 100644 --- a/src/Database/PostgreSQL/Simple/Migration.hs +++ b/src/Database/PostgreSQL/Simple/Migration.hs @@ -47,9 +47,7 @@ import Control.Monad (void, when) import qualified Crypto.Hash.MD5 as MD5 (hash) import qualified Data.ByteString as BS (ByteString, readFile) import qualified Data.ByteString.Base64 as B64 (encode) -import Data.Foldable (Foldable) import Data.List (isPrefixOf, sort) -import Data.Traversable (Traversable) #if __GLASGOW_HASKELL__ < 710 import Data.Monoid (Monoid (..)) #endif @@ -263,17 +261,17 @@ data MigrationCommand -- ^ Performs a series of 'MigrationCommand's in sequence. deriving (Show, Eq, Read, Ord) -#if __GLASGOW_HASKELL__ >= 804 instance Semigroup MigrationCommand where - (<>) = mappend -#endif + (MigrationCommands xs) <> (MigrationCommands ys) = MigrationCommands (xs ++ ys) + (MigrationCommands xs) <> y = MigrationCommands (xs ++ [y]) + x <> (MigrationCommands ys) = MigrationCommands (x : ys) + x <> y = MigrationCommands [x, y] instance Monoid MigrationCommand where mempty = MigrationCommands [] - mappend (MigrationCommands xs) (MigrationCommands ys) = MigrationCommands (xs ++ ys) - mappend (MigrationCommands xs) y = MigrationCommands (xs ++ [y]) - mappend x (MigrationCommands ys) = MigrationCommands (x : ys) - mappend x y = MigrationCommands [x, y] +#if !(MIN_VERSION_base(4,11,0)) + mappend = (<>) +#endif -- | A sum-type denoting the result of a single migration. data CheckScriptResult