packages feed

context-resource 0.2.0.0 → 0.2.0.1

raw patch · 5 files changed

+50/−48 lines, 5 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Change log +## 0.2.0.1++* Backwards compatibility with GHC 8.4 (@pbrisbin)+ ## 0.2.0.0  * Lift signatures from `IO` to `MonadIO`, `MonadThrow` and `MonadMask`
context-resource.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           context-resource-version:        0.2.0.0+version:        0.2.0.1 synopsis:       Thread-safe, pool-compatible resource provider description:    A thread-safe, pool-compatible resource provider abstraction that supports                 resource-sharing within nested actions.@@ -38,7 +38,7 @@       library   ghc-options: -Wall -fwarn-tabs -Wincomplete-uni-patterns -Wredundant-constraints   build-depends:-      base >=4.12 && <5+      base >=4.11.1.0 && <5     , context >=0.2.0.0 && <0.3     , exceptions >=0.10.0 && <0.11   default-language: Haskell2010
library/Context/Resource.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NoImplicitPrelude #-}@@ -47,7 +46,7 @@   -> (Provider m res -> m a)   -> m a withProvider withRes f = do-  Context.withStore Context.noPropagation (Just (WithRes withRes)) \store -> do+  Context.withStore Context.noPropagation (Just (WithRes withRes)) $ \store -> do     f Provider { store }  -- | Acquire a resource from the specified 'Provider', for the duration of the@@ -93,8 +92,8 @@   -> (res -> m a)   -> m a withSharedResource provider f = do-  withResource provider \resource -> do-    shareResource provider resource do+  withResource provider $ \resource -> do+    shareResource provider resource $ do       f resource  -- $intro
package.yaml view
@@ -1,5 +1,5 @@ name: context-resource-version: '0.2.0.0'+version: '0.2.0.1' github: "jship/context/context-resource" license: MIT license-file: LICENSE.md@@ -26,7 +26,7 @@  library:   dependencies:-  - base >=4.12 && <5+  - base >=4.11.1.0 && <5   - context >=0.2.0.0 && <0.3   - exceptions >=0.10.0 && <0.11   source-dirs: library
test-suite/Test/Context/ResourceSpec.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE BlockArguments #-} {-# LANGUAGE NoImplicitPrelude #-}  module Test.Context.ResourceSpec@@ -16,65 +15,65 @@  spec :: Spec spec = do-  describe "withResource" do-    it "concurrent test" do-      Async.forConcurrently_ [1 :: Int ..10] $ const do-        withProvider withRes \provider -> do-          withResource provider \ptr1 -> do-            withResource provider \ptr2 -> do+  describe "withResource" $ do+    it "concurrent test" $ do+      Async.forConcurrently_ [1 :: Int ..10] $ const $ do+        withProvider withRes $ \provider -> do+          withResource provider $ \ptr1 -> do+            withResource provider $ \ptr2 -> do               ptr1 `shouldNotBe` ptr2 -  describe "shareResource" do-    it "concurrent test" do-      Async.forConcurrently_ [1 :: Int ..10] $ const do-        withProvider withRes \provider -> do-          withResource provider \ptr1 -> do-            shareResource provider ptr1 do-              withResource provider \ptr2 -> do+  describe "shareResource" $ do+    it "concurrent test" $ do+      Async.forConcurrently_ [1 :: Int ..10] $ const $ do+        withProvider withRes $ \provider -> do+          withResource provider $ \ptr1 -> do+            shareResource provider ptr1 $ do+              withResource provider $ \ptr2 -> do                 ptr1 `shouldBe` ptr2-                withResource provider \ptr3 -> do+                withResource provider $ \ptr3 -> do                   ptr2 `shouldBe` ptr3-            withResource provider \ptr4 -> do+            withResource provider $ \ptr4 -> do               ptr1 `shouldNotBe` ptr4-    it "cannot implicitly share across thread boundaries" do-      withProvider withRes \provider -> do-        withResource provider \parentThread'sPtr1 -> do-          shareResource provider parentThread'sPtr1 do-            withResource provider \parentThread'sPtr2 -> do+    it "cannot implicitly share across thread boundaries" $ do+      withProvider withRes $ \provider -> do+        withResource provider $ \parentThread'sPtr1 -> do+          shareResource provider parentThread'sPtr1 $ do+            withResource provider $ \parentThread'sPtr2 -> do               parentThread'sPtr1 `shouldBe` parentThread'sPtr2             threadDone <- Context.newEmptyMVar-            Monad.void $ Context.forkIO do-              withResource provider \childThread'sPtr1 -> do+            Monad.void $ Context.forkIO $ do+              withResource provider $ \childThread'sPtr1 -> do                 parentThread'sPtr1 `shouldNotBe` childThread'sPtr1               Context.putMVar threadDone ()             Context.takeMVar threadDone-          withResource provider \parentThread'sPtr3 -> do+          withResource provider $ \parentThread'sPtr3 -> do             parentThread'sPtr1 `shouldNotBe` parentThread'sPtr3 -  describe "withSharedResource" do-    it "concurrent test" do-      Async.forConcurrently_ [1 :: Int ..10] $ const do-        withProvider withRes \provider -> do-          withSharedResource provider \ptr1 -> do-            withResource provider \ptr2 -> do+  describe "withSharedResource" $ do+    it "concurrent test" $ do+      Async.forConcurrently_ [1 :: Int ..10] $ const $ do+        withProvider withRes $ \provider -> do+          withSharedResource provider $ \ptr1 -> do+            withResource provider $ \ptr2 -> do               ptr1 `shouldBe` ptr2-              shareResource provider ptr2 do-                withResource provider \ptr3 -> do+              shareResource provider ptr2 $ do+                withResource provider $ \ptr3 -> do                   ptr2 `shouldBe` ptr3-            withResource provider \ptr4 -> do+            withResource provider $ \ptr4 -> do               ptr1 `shouldBe` ptr4-    it "cannot implicitly share across thread boundaries" do-      withProvider withRes \provider -> do-        withSharedResource provider \parentThread'sPtr1 -> do-          withResource provider \parentThread'sPtr2 -> do+    it "cannot implicitly share across thread boundaries" $ do+      withProvider withRes $ \provider -> do+        withSharedResource provider $ \parentThread'sPtr1 -> do+          withResource provider $ \parentThread'sPtr2 -> do             parentThread'sPtr1 `shouldBe` parentThread'sPtr2           threadDone <- Context.newEmptyMVar-          Monad.void $ Context.forkIO do-            withResource provider \childThread'sPtr1 -> do+          Monad.void $ Context.forkIO $ do+            withResource provider $ \childThread'sPtr1 -> do               parentThread'sPtr1 `shouldNotBe` childThread'sPtr1             Context.putMVar threadDone ()           Context.takeMVar threadDone-          withResource provider \parentThread'sPtr3 -> do+          withResource provider $ \parentThread'sPtr3 -> do             parentThread'sPtr1 `shouldBe` parentThread'sPtr3  withRes :: (Ptr Int -> IO a) -> IO a