Skip to content

Commit

Permalink
Prepare v0.0.3.0 release (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
tchoutri authored Oct 30, 2022
1 parent a6b1736 commit 3d9a29a
Show file tree
Hide file tree
Showing 15 changed files with 942 additions and 888 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/cpus.sh

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/fourmolu-runner.sh

This file was deleted.

38 changes: 13 additions & 25 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,29 @@ on:
branches: ["main", "development"]

jobs:
fourmolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: fourmolu/fourmolu-action@v4
with:
pattern: |
src/**/*.hs
test/**/*.hs
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2

- name: 'Set up HLint'
uses: rwe/actions-hlint-setup@v1
with:
version: '3.4'
version: '3.3.6'

- name: 'Run HLint'
uses: rwe/actions-hlint-run@v1
with:
path: '["src/", "test/"]'
fail-on: warning

styling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Haskell
id: setup-haskell
uses: haskell/actions/setup@v1
with:
ghc-version: "9.2.3"
cabal-version: "latest"

- name: Install tools
run: |
cd ~/
echo "$HOME/.ghcup/bin" >> $GITHUB_PATH
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
cabal install -j fourmolu
- name: Running fourmolu
run: ./.github/workflows/fourmolu-runner.sh
4 changes: 4 additions & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
- ignore: {name: "Redundant ^."}
- ignore: {name: "Eta reduce"}
- ignore: {name: "Avoid lambda"}
- ignore: {name: "Avoid lambda using `infix`"}
- ignore: {name: "Use newtype instead of data"}
- ignore: {name: "Use tuple-section"}
- ignore: {name: "Monad law, left identity"}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Revision history for Entity

## 0.0.3.0 -- 2022-10-30

* Fix compilation with resource-pool <0.3 (#51)

## 0.0.2.0 -- 2022-08-27

This is an experimental release
Expand Down
37 changes: 19 additions & 18 deletions example/src/Processing/Entity.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,32 +27,33 @@ data EntityError
| EntityProcessingIsRunning
deriving (Eq, Show)

insertEntity ::
(MonadIO m) =>
E ->
DBT m ()
insertEntity
:: (MonadIO m)
=> E
-> DBT m ()
insertEntity = insert @E

getEntity ::
(MonadError EntityError m, MonadIO m) =>
Int ->
DBT m E
getEntity
:: (MonadError EntityError m, MonadIO m)
=> Int
-> DBT m E
getEntity key = do
result <- selectById (Only key)
case result of
Just e -> pure e
Nothing -> lift $ throwError EntityNotFound

-- | We fetch the entity by its key
-- We check if it is in a good state by checking the flag
-- If the 'state' flag is False, we throw EntityBadState
-- We check if it is already processing by checking the flag
-- If the 'processing' flag is True, we throw EntityProcessingIsRunning
-- Otherwise, we switch the the 'processing' flag to true
markForProcessing ::
(MonadError EntityError m, MonadIO m) =>
Int ->
DBT m ()
{-| We fetch the entity by its key
We check if it is in a good state by checking the flag
If the 'state' flag is False, we throw EntityBadState
We check if it is already processing by checking the flag
If the 'processing' flag is True, we throw EntityProcessingIsRunning
Otherwise, we switch the the 'processing' flag to true
-}
markForProcessing
:: (MonadError EntityError m, MonadIO m)
=> Int
-> DBT m ()
markForProcessing key = do
entity <- getEntity key
checkSanity entity
Expand Down
3 changes: 2 additions & 1 deletion fourmolu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import-export-style: leading
record-brace-space: false # rec {x = 1} vs. rec{x = 1}
indent-wheres: true # 'false' means save space by only half-indenting the 'where' keyword
respectful: true # don't be too opinionated about newlines etc.
haddock-style: single-line # '--' vs. '{-'
haddock-style: multi-line-compact # '--' vs. '{-'
newlines-between-decls: 1 # number of newlines between top-level declarations
fixities: []
function-arrows: leading
6 changes: 3 additions & 3 deletions pg-entity.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description:
A PostgreSQL layer to safely expand your SQL queries with a lightweight eDSL.
Read the tutorial at https://tchoutri.github.io/pg-entity/Tutorial

version: 0.0.2.0
version: 0.0.3.0
homepage: https://tchoutri.github.io/pg-entity
bug-reports: https://github.com/tchoutri/pg-entity/issues
author: Théophile Choutri
Expand Down Expand Up @@ -84,7 +84,7 @@ library

hs-source-dirs: src
build-depends:
, base >=4.12 && <=4.18
, base >=4.12 && <4.18.0
, bytestring ^>=0.11
, colourista ^>=0.1
, exceptions ^>=0.10
Expand All @@ -94,7 +94,7 @@ library
, postgresql-simple ^>=0.6
, resource-pool ^>=0.3
, safe-exceptions ^>=0.1
, template-haskell >=2.15.0.0 && <=2.18.0.0
, template-haskell >=2.15.0.0 && <2.18.0.0.0
, text ^>=2.0
, text-display ^>=0.0
, text-manipulate ^>=0.3
Expand Down
Loading

0 comments on commit 3d9a29a

Please sign in to comment.