Skip to content

Commit f9e9d1b

Browse files
committed
Switch from readline to haskeline
Apparently `readline` doesn't build with newer versions of cabal.
1 parent 4c29aa0 commit f9e9d1b

File tree

7 files changed

+491
-10
lines changed

7 files changed

+491
-10
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
timeout-minutes:
2828
60
2929
container:
30-
image: buildpack-deps:bionic
30+
image: buildpack-deps:jammy
3131
services:
3232
postgres:
3333
image: postgres:14

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# hpqtypes-1.12.1.0 (????-??-??)
2+
* Switch from `readline` to `haskeline`, to make example compile with newer
3+
Cabal versions.
4+
15
# hpqtypes-1.12.0.0 (2024-03-18)
26
* Drop support for GHC 8.8.
37
* Attach `CallStack` and `BackendPid` to `DBException`.

cabal.haskell-ci

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
distribution: jammy
12
branches: master
23
doctest: False
34
tests: True

examples/Catalog.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import Control.Arrow (second)
44
import Control.Monad
55
import Control.Monad.Base
66
import Control.Monad.Catch
7-
import Data.Function
7+
import Control.Monad.IO.Class (liftIO)
88
import Data.Int
99
import Data.Monoid.Utils
1010
import Data.Pool
1111
import Data.Text qualified as T
1212
import Database.PostgreSQL.PQTypes
1313
import Database.PostgreSQL.PQTypes.Internal.Utils (mread)
14-
import System.Console.Readline
14+
import System.Console.Haskeline
1515
import System.Environment
1616

1717
-- | Generic 'putStrLn'.
@@ -144,13 +144,14 @@ catalog = do
144144
cs <- getConnSettings
145145
withCatalog cs $ do
146146
ConnectionSource pool <- poolSource (cs {csComposites = ["book_"]}) (\connect disconnect -> defaultPoolConfig connect disconnect 1 10)
147-
fix $ \next ->
148-
readline "> "
147+
runInputT defaultSettings (loop pool)
148+
where
149+
loop pool = do
150+
getInputLine "> "
149151
>>= maybe
150-
(printLn "")
152+
(outputStrLn "")
151153
( \cmd -> do
152154
when (cmd /= "quit") $ do
153-
processCommand pool cmd
154-
addHistory cmd
155-
next
155+
liftIO $ processCommand pool cmd
156+
loop pool
156157
)

0 commit comments

Comments
 (0)