Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from readline to haskeline #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
, resource-pool >= 0.4
, scientific
, test-framework >= 0.8
Expand Down
Loading