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

GHC 9 compatibility #308

Merged
merged 16 commits into from
Apr 23, 2022
47 changes: 17 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the dev branch
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
ghc8_10:
# The type of runner that the job will run on
ghc9_0:
runs-on: ubuntu-latest

services:
Expand All @@ -27,16 +22,14 @@ jobs:
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
with:
ghc-version: '8.10.5' # Exact version of ghc to use
# cabal-version: 'latest'. Omitted, but defalts to 'latest'
enable-stack: true
stack-version: 'latest'
stack-no-global: true
stack-setup-ghc: true

- name: build
run: stack build --fast
Expand All @@ -63,8 +56,7 @@ jobs:
".stack-work"
"/root/.stack/"
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
ghc8_8:
# The type of runner that the job will run on
ghc8_10:
runs-on: ubuntu-latest

services:
Expand All @@ -79,22 +71,20 @@ jobs:
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
with:
ghc-version: '8.8.4' # Exact version of ghc to use
# cabal-version: 'latest'. Omitted, but defalts to 'latest'
enable-stack: true
stack-version: 'latest'
stack-no-global: true
stack-setup-ghc: true

- name: build
run: stack build --fast
run: stack build --fast --stack-yaml stack-ghc8_10.yaml

- name: test
run: stack test --fast
run: stack test --fast --stack-yaml stack-ghc8_10.yaml
env:
PG_USER: postgres
PG_HOST: localhost
Expand All @@ -103,10 +93,10 @@ jobs:
PG_PORT: ${{ job.services.postgres.ports['5432'] }}

- name: benchmark
run: stack bench --fast
run: stack bench --fast --stack-yaml stack-ghc8_10.yaml

- name: documentation
run: stack haddock --fast
run: stack haddock --fast --stack-yaml stack-ghc8_10.yaml

- name: cache
uses: actions/cache@v2
Expand All @@ -115,8 +105,7 @@ jobs:
".stack-work"
"/root/.stack/"
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
ghc8_6:
# The type of runner that the job will run on
ghc8_8:
runs-on: ubuntu-latest

services:
Expand All @@ -131,22 +120,20 @@ jobs:
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: haskell/actions/setup@v1
with:
ghc-version: '8.6.5' # Exact version of ghc to use
# cabal-version: 'latest'. Omitted, but defalts to 'latest'
enable-stack: true
stack-version: 'latest'
stack-no-global: true
stack-setup-ghc: true

- name: build
run: stack build --fast
run: stack build --fast --stack-yaml stack-ghc8_8.yaml

- name: test
run: stack test --fast
run: stack test --fast --stack-yaml stack-ghc8_8.yaml
env:
PG_USER: postgres
PG_HOST: localhost
Expand All @@ -155,10 +142,10 @@ jobs:
PG_PORT: ${{ job.services.postgres.ports['5432'] }}

- name: benchmark
run: stack bench --fast
run: stack bench --fast --stack-yaml stack-ghc8_8.yaml

- name: documentation
run: stack haddock --fast
run: stack haddock --fast --stack-yaml stack-ghc8_8.yaml

- name: cache
uses: actions/cache@v2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ cabal.sandbox.config
cabal.project.local
.DS_Store
stack.yaml.lock
*.yaml.lock
tags
.*.swp
12 changes: 6 additions & 6 deletions squeal-postgresql-ltree/src/Squeal/PostgreSQL/LTree.hs
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ instance TypeError ('Text "LTree binary instances not yet implemented.")
=> ToPG db LTree where
toPG = pure . Encoding.text_strict . getLTree
instance Inline LTree where
inline
inline (UnsafeLTree x)
= UnsafeExpression
. parenthesized
. (<> " :: ltree")
. escapeQuotedText
. getLTree
$ x

{- |
lquery represents a regular-expression-like pattern for matching ltree values.
Expand Down Expand Up @@ -228,12 +228,12 @@ instance TypeError ('Text "LQuery binary instances not yet implemented.")
=> ToPG db LQuery where
toPG = pure . Encoding.text_strict . getLQuery
instance Inline LQuery where
inline
inline (UnsafeLQuery x)
= UnsafeExpression
. parenthesized
. (<> " :: lquery")
. escapeQuotedText
. getLQuery
$ x

{- |
ltxtquery represents a full-text-search-like pattern for matching ltree values.
Expand Down Expand Up @@ -269,12 +269,12 @@ instance TypeError ('Text "LTxtQuery binary instances not yet implemented.")
=> ToPG db LTxtQuery where
toPG = pure . Encoding.text_strict . getLTxtQuery
instance Inline LTxtQuery where
inline
inline (UnsafeLTxtQuery x)
= UnsafeExpression
. parenthesized
. (<> " :: ltxtquery")
. escapeQuotedText
. getLTxtQuery
$ x

instance IsString
(Expression grp lat with db params from (null PGltree)) where
Expand Down
3 changes: 2 additions & 1 deletion squeal-postgresql/squeal-postgresql.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ test-suite doctest
build-depends:
base >= 4.12.0.0 && < 5.0
, doctest >= 0.16.3
, squeal-postgresql
if impl(ghc >= 9.0.0)
buildable: False

test-suite properties
default-language: Haskell2010
Expand Down
4 changes: 2 additions & 2 deletions squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function
:: (Has sch db schema, Has fun schema ('Function ('[x] :=> 'Returns y)))
=> QualifiedAlias sch fun -- ^ function name
-> Fun db x y
function = unsafeFunction . renderSQL
function f = unsafeFunction $ renderSQL f

-- | >>> printSQL $ unsafeFunctionN "f" (currentTime :* localTimestamp :* false *: inline 'a')
-- f(CURRENT_TIME, LOCALTIMESTAMP, FALSE, (E'a' :: char(1)))
Expand All @@ -369,7 +369,7 @@ functionN
, SListI xs )
=> QualifiedAlias sch fun -- ^ function alias
-> FunN db xs y
functionN = unsafeFunctionN . renderSQL
functionN f = unsafeFunctionN $ renderSQL f

instance
Num (Expression grp lat with db params from (null 'PGint2)) where
Expand Down
Loading