Skip to content

Commit

Permalink
Merge patch into master
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored and 414owen committed Apr 22, 2024
2 parents eb29621 + 68a10ee commit 94cb0fe
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 128 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/cd.yaml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Compile, test and check the docs

on:
workflow_call:

jobs:

check:

strategy:
fail-fast: false
matrix:
include:
- ghc: 8.8.1
ghc-options: ""
ignore-haddock: "true"
- ghc: latest

runs-on: ubuntu-latest

steps:

- uses: nikita-volkov/build-and-test-cabal-package.github-action@v1
with:
ghc: ${{matrix.ghc}}
ghc-options: ${{matrix.ghc-options}}
ignore-haddock: ${{matrix.ignore-haddock}}
73 changes: 0 additions & 73 deletions .github/workflows/ci.yaml

This file was deleted.

15 changes: 15 additions & 0 deletions .github/workflows/on-push-to-master-or-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
push:
branches:
- master
pull_request:

jobs:

format:
uses: nikita-volkov/haskell-hackage-lib-github-actions-workflows/.github/workflows/format.yaml@v1
secrets: inherit

check:
uses: ./.github/workflows/check.yaml
secrets: inherit
30 changes: 30 additions & 0 deletions .github/workflows/on-push-to-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
branches:
- supermajor
- major
- minor
- patch

concurrency:
group: release
cancel-in-progress: false

jobs:

format:
uses: nikita-volkov/haskell-hackage-lib-github-actions-workflows/.github/workflows/format.yaml@v1
secrets: inherit

check:
uses: ./.github/workflows/check.yaml
secrets: inherit

release:
needs:
- format
- check
uses: nikita-volkov/haskell-hackage-lib-github-actions-workflows/.github/workflows/release.yaml@v1
secrets: inherit
with:
prefix-tag-with-v: false
3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages: .
allow-newer:
, foldl:text
11 changes: 9 additions & 2 deletions library/StmContainers/Map.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module StmContainers.Map
reset,
unfoldlM,
listT,
listTNonAtomic,
)
where

Expand Down Expand Up @@ -111,5 +112,11 @@ unfoldlM (Map hamt) =
-- Stream the associations passively.
{-# INLINE listT #-}
listT :: Map key value -> ListT STM (key, value)
listT (Map hamt) =
fmap (\(Product2 k v) -> (k, v)) (A.listT hamt)
listT (Map hamt) = fmap (\(Product2 k v) -> (k, v)) (A.listT hamt)

-- |
-- Stream the associations passively.
-- Data may be inconsistent/out of date.
{-# INLINE listTNonAtomic #-}
listTNonAtomic :: Map key value -> ListT IO (key, value)
listTNonAtomic (Map hamt) = fmap (\(Product2 k v) -> (k, v)) (A.listTNonAtomic hamt)

Check failure on line 122 in library/StmContainers/Map.hs

View workflow job for this annotation

GitHub Actions / check / check (8.8.1, true)

Not in scope: ‘A.listTNonAtomic’

Check failure on line 122 in library/StmContainers/Map.hs

View workflow job for this annotation

GitHub Actions / check / check (latest)

Not in scope: ‘A.listTNonAtomic’
2 changes: 1 addition & 1 deletion library/StmContainers/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import Data.Either as Exports
import Data.Fixed as Exports
import Data.Foldable as Exports
import Data.Function as Exports hiding (id, (.))
import Data.Functor as Exports
import Data.Functor as Exports hiding (unzip)
import Data.Hashable as Exports (Hashable (..))
import Data.IORef as Exports
import Data.Int as Exports
Expand Down
2 changes: 1 addition & 1 deletion stm-containers.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: stm-containers
version: 1.2.0.2
version: 1.2.0.3
synopsis: Containers for STM
description:
This library is based on an STM-specialized implementation of
Expand Down
9 changes: 5 additions & 4 deletions test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import Prelude

main :: IO ()
main =
defaultMain . testGroup "" $
[ testGroup "Bimap" Suites.Bimap.tests,
testGroup "Map" Suites.Map.tests
]
defaultMain
. testGroup ""
$ [ testGroup "Bimap" Suites.Bimap.tests,
testGroup "Map" Suites.Map.tests
]
24 changes: 12 additions & 12 deletions test/Suites/Map.hs
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ instance Hashable TestKey where

tests :: [TestTree]
tests =
[ testProperty "sizeAndList" $
let gen = do
keys <- nub <$> listOf (choose ('a', 'z'))
mapM (liftA2 (flip (,)) (choose (0, 99 :: Int)) . pure) keys
prop list =
length list == stmMapLength
where
stmMapLength =
unsafePerformIO $ atomically $ do
x <- stmMapFromList list
StmMap.size x
in forAll gen prop,
[ testProperty "sizeAndList"
$ let gen = do
keys <- nub <$> listOf (choose ('a', 'z'))
mapM (liftA2 (flip (,)) (choose (0, 99 :: Int)) . pure) keys
prop list =
length list == stmMapLength
where
stmMapLength =
unsafePerformIO $ atomically $ do
x <- stmMapFromList list
StmMap.size x
in forAll gen prop,
testProperty "fromListToListHashMapIsomorphism" $ \(list :: [(Text, Int)]) ->
let hashMapList = HashMap.toList (HashMap.fromList list)
stmMapList = unsafePerformIO $ atomically $ stmMapFromList list >>= stmMapToList
Expand Down

0 comments on commit 94cb0fe

Please sign in to comment.