Skip to content

Commit

Permalink
Switch from readline to haskeline
Browse files Browse the repository at this point in the history
Apparently `readline` doesn't build with newer versions of cabal.

Also update CI configuration to make it work, see:
haskell-CI/haskell-ci#738 (comment)
  • Loading branch information
joncol committed Oct 9, 2024
1 parent 4c29aa0 commit d4bb606
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
timeout-minutes:
60
container:
image: buildpack-deps:bionic
image: buildpack-deps:jammy
services:
postgres:
image: postgres:14
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# hpqtypes-1.12.1.0 (????-??-??)
* Switch from `readline` to `haskeline`, to make example compile with newer
Cabal versions.

# hpqtypes-1.12.0.0 (2024-03-18)
* Drop support for GHC 8.8.
* Attach `CallStack` and `BackendPid` to `DBException`.
Expand Down
1 change: 1 addition & 0 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
distribution: jammy
branches: master
doctest: False
tests: True
Expand Down
17 changes: 9 additions & 8 deletions examples/Catalog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import Control.Arrow (second)
import Control.Monad
import Control.Monad.Base
import Control.Monad.Catch
import Data.Function
import Control.Monad.IO.Class (liftIO)
import Data.Int
import Data.Monoid.Utils
import Data.Pool
import Data.Text qualified as T
import Database.PostgreSQL.PQTypes
import Database.PostgreSQL.PQTypes.Internal.Utils (mread)
import System.Console.Readline
import System.Console.Haskeline
import System.Environment

-- | Generic 'putStrLn'.
Expand Down Expand Up @@ -144,13 +144,14 @@ catalog = do
cs <- getConnSettings
withCatalog cs $ do
ConnectionSource pool <- poolSource (cs {csComposites = ["book_"]}) (\connect disconnect -> defaultPoolConfig connect disconnect 1 10)
fix $ \next ->
readline "> "
runInputT defaultSettings (loop pool)
where
loop pool = do
getInputLine "> "
>>= maybe
(printLn "")
(outputStrLn "")
( \cmd -> do
when (cmd /= "quit") $ do
processCommand pool cmd
addHistory cmd
next
liftIO $ processCommand pool cmd
loop pool
)
2 changes: 1 addition & 1 deletion hpqtypes.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ test-suite hpqtypes-tests
, monad-control >= 1.0.3
, mtl >= 2.1
, random >= 1.0
, readline >= 1.0.3.0
, haskeline >= 0.8.2.1
, resource-pool >= 0.4
, scientific
, test-framework >= 0.8
Expand Down

0 comments on commit d4bb606

Please sign in to comment.