Skip to content

Commit 41d650d

Browse files
authored
Merge pull request #116 from haskellari/aeson-2.2
Support aeson-2.2
2 parents 34b609d + fd20fc6 commit 41d650d

4 files changed

Lines changed: 24 additions & 17 deletions

File tree

.github/workflows/haskell-ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#
99
# For more information, see https://github.com/haskell-CI/haskell-ci
1010
#
11-
# version: 0.16
11+
# version: 0.16.6
1212
#
13-
# REGENDATA ("0.16",["github","cabal.project"])
13+
# REGENDATA ("0.16.6",["github","cabal.project"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -38,19 +38,19 @@ jobs:
3838
strategy:
3939
matrix:
4040
include:
41-
- compiler: ghc-9.6.1
41+
- compiler: ghc-9.6.2
4242
compilerKind: ghc
43-
compilerVersion: 9.6.1
43+
compilerVersion: 9.6.2
4444
setup-method: ghcup
4545
allow-failure: false
46-
- compiler: ghc-9.4.4
46+
- compiler: ghc-9.4.5
4747
compilerKind: ghc
48-
compilerVersion: 9.4.4
48+
compilerVersion: 9.4.5
4949
setup-method: ghcup
5050
allow-failure: false
51-
- compiler: ghc-9.2.7
51+
- compiler: ghc-9.2.8
5252
compilerKind: ghc
53-
compilerVersion: 9.2.7
53+
compilerVersion: 9.2.8
5454
setup-method: ghcup
5555
allow-failure: false
5656
- compiler: ghc-9.0.2

CHANGES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
### Version 0.6.5.1 (2023-07-09)
2+
3+
* Support `aeson-2.2.0.0`
4+
15
### Version 0.6.5 (2022-10-30)
26

37
* Add `withConnect`

postgresql-simple.cabal

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cabal-version: 1.12
22
name: postgresql-simple
3-
version: 0.6.5
4-
x-revision: 1
3+
version: 0.6.5.1
54
synopsis: Mid-Level PostgreSQL client library
65
description:
76
Mid-Level PostgreSQL client library, forked from mysql-simple.
@@ -34,9 +33,9 @@ tested-with:
3433
|| ==8.8.4
3534
|| ==8.10.7
3635
|| ==9.0.2
37-
|| ==9.2.7
38-
|| ==9.4.4
39-
|| ==9.6.1
36+
|| ==9.2.8
37+
|| ==9.4.5
38+
|| ==9.6.2
4039

4140
library
4241
default-language: Haskell2010
@@ -92,7 +91,7 @@ library
9291

9392
-- Other dependencies
9493
build-depends:
95-
aeson >=1.4.1.0 && <1.6 || >=2.0.0.0 && <2.2
94+
aeson >=1.4.1.0 && <1.6 || >=2.0.0.0 && <2.3
9695
, attoparsec >=0.13.2.2 && <0.15
9796
, bytestring-builder >=0.10.8.1.0 && <0.11
9897
, case-insensitive >=1.2.0.11 && <1.3

src/Database/PostgreSQL/Simple/FromField.hs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ import Control.Applicative ( Const(Const), (<|>), (<$>), pure, (*>), (
120120
import Control.Concurrent.MVar (MVar, newMVar)
121121
import Control.Exception (Exception)
122122
import qualified Data.Aeson as JSON
123-
import qualified Data.Aeson.Internal as JSON
124-
import qualified Data.Aeson.Parser as JSON (value')
125123
import Data.Attoparsec.ByteString.Char8 hiding (Result)
126124
import Data.ByteString (ByteString)
127125
import qualified Data.ByteString.Char8 as B
@@ -156,6 +154,12 @@ import qualified Data.UUID.Types as UUID
156154
import Data.Scientific (Scientific)
157155
import GHC.Real (infinity, notANumber)
158156

157+
#if MIN_VERSION_aeson(2,1,2)
158+
import qualified Data.Aeson.Types as JSON
159+
#else
160+
import qualified Data.Aeson.Internal as JSON
161+
#endif
162+
159163
-- | Exception thrown if conversion from a SQL value to a Haskell
160164
-- value fails.
161165
data ResultError = Incompatible { errSQLType :: String
@@ -574,7 +578,7 @@ instance FromField UUID where
574578
-- | json, jsonb
575579
instance FromField JSON.Value where
576580
fromField f mbs = parseBS =<< fromFieldJSONByteString f mbs
577-
where parseBS bs = case parseOnly (JSON.value' <* endOfInput) bs of
581+
where parseBS bs = case JSON.eitherDecodeStrict' bs of
578582
Left err -> returnError ConversionFailed f err
579583
Right val -> pure val
580584

0 commit comments

Comments
 (0)