From a499c35d5b3090fecfabda50c9a6e1852d022821 Mon Sep 17 00:00:00 2001 From: Paul Brinkmeier Date: Tue, 15 Jul 2025 23:31:41 +0200 Subject: [PATCH] Bump opium to remove dependency on postgresql-libpq --- app/Main.hs | 4 ++-- flake.lock | 8 ++++---- src/Yore/DB.hs | 3 +-- src/Yore/Repl.hs | 10 ++++------ yore.cabal | 2 -- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/app/Main.hs b/app/Main.hs index 9aae159..23209b7 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -2,13 +2,13 @@ module Main (main) where -import Database.PostgreSQL.LibPQ (connectdb) +import qualified Database.PostgreSQL.Opium as Opium import qualified Yore.DB main :: IO () main = do - conn <- connectdb "host=localhost port=5432" + conn <- Opium.connect "host=localhost port=5432" result <- Yore.DB.getTables conn case result of diff --git a/flake.lock b/flake.lock index 3e2aefa..748e442 100644 --- a/flake.lock +++ b/flake.lock @@ -64,11 +64,11 @@ ] }, "locked": { - "lastModified": 1752596794, - "narHash": "sha256-1J3tNaosj3DCQuzDCPdbEbOd5ZQuqIOAVD7o5hFNx+g=", + "lastModified": 1752614832, + "narHash": "sha256-rwLQ1xsYus6on4PSTwM2ti36Iwk5gr9lDKwFOZ451OI=", "ref": "main", - "rev": "3879c2603fa124087a3ed810903bf75d38a27598", - "revCount": 56, + "rev": "2fddc958b9e6b616f89570dfa44503bccd165c02", + "revCount": 59, "type": "git", "url": "https://git.pbrinkmeier.de/paul/opium" }, diff --git a/src/Yore/DB.hs b/src/Yore/DB.hs index f11c253..3367916 100644 --- a/src/Yore/DB.hs +++ b/src/Yore/DB.hs @@ -5,7 +5,6 @@ module Yore.DB , getTables ) where -import Database.PostgreSQL.LibPQ (Connection) import GHC.Generics (Generic) import qualified Database.PostgreSQL.Opium as Opium @@ -17,5 +16,5 @@ data Table = Table instance Opium.FromRow Table -getTables :: Connection -> IO (Either Opium.Error [Table]) +getTables :: Opium.Connection -> IO (Either Opium.Error [Table]) getTables = Opium.fetch_ "SELECT table_schema AS schema, table_name AS name FROM information_schema.tables" diff --git a/src/Yore/Repl.hs b/src/Yore/Repl.hs index 52c05d9..bd677d8 100644 --- a/src/Yore/Repl.hs +++ b/src/Yore/Repl.hs @@ -2,12 +2,10 @@ module Yore.Repl (connect, exec) where -import qualified Database.PostgreSQL.LibPQ as LibPQ +import qualified Database.PostgreSQL.Opium as Opium -import Database.PostgreSQL.LibPQ (Connection) +connect :: IO Opium.Connection +connect = Opium.connect "host=localhost" -connect :: IO Connection -connect = LibPQ.connectdb "host=localhost" - -exec :: (Connection -> IO a) -> IO a +exec :: (Opium.Connection -> IO a) -> IO a exec f = f =<< connect diff --git a/yore.cabal b/yore.cabal index d40ffca..8fcae2b 100644 --- a/yore.cabal +++ b/yore.cabal @@ -38,7 +38,6 @@ library build-depends: base >=4.18 && <5 , opium - , postgresql-libpq executable yore import: shared-options @@ -57,7 +56,6 @@ executable yore , bytestring , http-media , opium - , postgresql-libpq , servant-server , text , wai