Skip to content

Commit fe9f956

Browse files
authored
Merge pull request #43 from zmactep/maksbotan/int-as-double
Support unpacking DB Int as Double
2 parents 80de79a + ed1f68d commit fe9f956

File tree

3 files changed

+41
-27
lines changed

3 files changed

+41
-27
lines changed

.github/workflows/haskell-ci.yml

Lines changed: 31 additions & 20 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.14.3
11+
# version: 0.16.6
1212
#
13-
# REGENDATA ("0.14.3",["github","hasbolt.cabal"])
13+
# REGENDATA ("0.16.6",["github","hasbolt.cabal"])
1414
#
1515
name: Haskell-CI
1616
on:
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
linux:
2525
name: Haskell-CI - Linux - ${{ matrix.compiler }}
26-
runs-on: ubuntu-18.04
26+
runs-on: ubuntu-20.04
2727
timeout-minutes:
2828
60
2929
container:
@@ -32,14 +32,19 @@ jobs:
3232
strategy:
3333
matrix:
3434
include:
35-
- compiler: ghc-9.4.4
35+
- compiler: ghc-9.6.2
3636
compilerKind: ghc
37-
compilerVersion: 9.4.4
37+
compilerVersion: 9.6.2
3838
setup-method: ghcup
3939
allow-failure: true
40-
- compiler: ghc-9.2.5
40+
- compiler: ghc-9.4.5
4141
compilerKind: ghc
42-
compilerVersion: 9.2.5
42+
compilerVersion: 9.4.5
43+
setup-method: ghcup
44+
allow-failure: true
45+
- compiler: ghc-9.2.8
46+
compilerKind: ghc
47+
compilerVersion: 9.2.8
4348
setup-method: ghcup
4449
allow-failure: true
4550
- compiler: ghc-9.0.2
@@ -70,18 +75,18 @@ jobs:
7075
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
7176
if [ "${{ matrix.setup-method }}" = ghcup ]; then
7277
mkdir -p "$HOME/.ghcup/bin"
73-
curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup"
78+
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
7479
chmod a+x "$HOME/.ghcup/bin/ghcup"
75-
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
76-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
80+
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
81+
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
7782
else
7883
apt-add-repository -y 'ppa:hvr/ghc'
7984
apt-get update
8085
apt-get install -y "$HCNAME"
8186
mkdir -p "$HOME/.ghcup/bin"
82-
curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup"
87+
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
8388
chmod a+x "$HOME/.ghcup/bin/ghcup"
84-
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
89+
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
8590
fi
8691
env:
8792
HCKIND: ${{ matrix.compilerKind }}
@@ -99,13 +104,13 @@ jobs:
99104
echo "HC=$HC" >> "$GITHUB_ENV"
100105
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
101106
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
102-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
107+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
103108
else
104109
HC=$HCDIR/bin/$HCKIND
105110
echo "HC=$HC" >> "$GITHUB_ENV"
106111
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
107112
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
108-
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
113+
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
109114
fi
110115
111116
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
@@ -157,14 +162,14 @@ jobs:
157162
- name: install cabal-plan
158163
run: |
159164
mkdir -p $HOME/.cabal/bin
160-
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
161-
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
165+
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
166+
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
162167
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
163168
rm -f cabal-plan.xz
164169
chmod a+x $HOME/.cabal/bin/cabal-plan
165170
cabal-plan --version
166171
- name: checkout
167-
uses: actions/checkout@v2
172+
uses: actions/checkout@v3
168173
with:
169174
path: source
170175
- name: initial cabal.project for sdist
@@ -199,8 +204,8 @@ jobs:
199204
run: |
200205
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
201206
cabal-plan
202-
- name: cache
203-
uses: actions/cache@v2
207+
- name: restore cache
208+
uses: actions/cache/restore@v3
204209
with:
205210
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
206211
path: ~/.cabal/store
@@ -224,8 +229,14 @@ jobs:
224229
${CABAL} -vnormal check
225230
- name: haddock
226231
run: |
227-
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
232+
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
228233
- name: unconstrained build
229234
run: |
230235
rm -f cabal.project.local
231236
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
237+
- name: save cache
238+
uses: actions/cache/save@v3
239+
if: always()
240+
with:
241+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
242+
path: ~/.cabal/store

hasbolt.cabal

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: hasbolt
2-
version: 0.1.6.2
2+
version: 0.1.6.3
33
synopsis: Haskell driver for Neo4j 3+ (BOLT protocol)
44
description:
55
Haskell driver for Neo4j 3+ (BOLT protocol).
@@ -39,8 +39,9 @@ tested-with:
3939
|| ==8.8.4
4040
|| ==8.10.7
4141
|| ==9.0.2
42-
|| ==9.2.5
43-
|| ==9.4.4
42+
|| ==9.2.8
43+
|| ==9.4.5
44+
|| ==9.6.2
4445

4546
library
4647
hs-source-dirs: src

src/Database/Bolt/Record.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Control.Monad.Except (MonadError (..), withExcept
1212
import Data.Map.Strict (Map)
1313
import qualified Data.Map.Strict as M (lookup)
1414
import Data.Text (Text)
15+
import GHC.Float (int2Double)
1516

1617
-- |Result type for query requests
1718
type Record = Map Text Value
@@ -28,7 +29,7 @@ exactMaybe = either (const Nothing) Just . exactEither
2829

2930
instance RecordValue () where
3031
exactEither (N _) = pure ()
31-
exactEither _ = throwError NotNull
32+
exactEither _ = throwError NotNull
3233

3334
instance RecordValue Bool where
3435
exactEither (B b) = pure b
@@ -40,6 +41,7 @@ instance RecordValue Int where
4041

4142
instance RecordValue Double where
4243
exactEither (F d) = pure d
44+
exactEither (I i) = pure $ int2Double i
4345
exactEither _ = throwError NotFloat
4446

4547
instance RecordValue Text where
@@ -51,7 +53,7 @@ instance RecordValue Value where
5153

5254
instance RecordValue a => RecordValue [a] where
5355
exactEither (L l) = traverse exactEither l
54-
exactEither _ = throwError NotList
56+
exactEither _ = throwError NotList
5557

5658
instance RecordValue a => RecordValue (Maybe a) where
5759
exactEither (N _) = pure Nothing
@@ -63,15 +65,15 @@ instance RecordValue (Map Text Value) where
6365

6466
instance RecordValue Node where
6567
exactEither (S s) = fromStructure s
66-
exactEither _ = throwError $ Not "Node"
68+
exactEither _ = throwError $ Not "Node"
6769

6870
instance RecordValue Relationship where
6971
exactEither (S s) = fromStructure s
7072
exactEither _ = throwError $ Not "Relationship"
7173

7274
instance RecordValue URelationship where
7375
exactEither (S s) = fromStructure s
74-
exactEither _ = throwError $ Not "URelationship"
76+
exactEither _ = throwError $ Not "URelationship"
7577

7678
instance RecordValue Path where
7779
exactEither (S s) = fromStructure s

0 commit comments

Comments
 (0)