general-allocate 0.2.1.4 → 0.2.2.0
raw patch · 4 files changed
+16/−7 lines, 4 filesdep ~basedep ~containersdep ~primitive
Dependency ranges changed: base, containers, primitive
Files
- CHANGELOG.md +5/−0
- general-allocate.cabal +4/−4
- src/Control/Monad/With.hs +4/−2
- src/Control/Monad/With.hs-boot +3/−1
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for general-allocate +## 0.2.2.0 -- 2024-01-11++* Allow newer versions of some dependencies+* Fixing deriving MonadWith instances+ ## 0.2.1.4 -- 2023-03-01 * Allow older `primitive`
general-allocate.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: general-allocate-version: 0.2.1.4+version: 0.2.2.0 license: Apache-2.0 license-file: LICENSE author: Shea Levy@@ -48,10 +48,10 @@ Data.Exceptable build-depends:- , base ^>= { 4.14, 4.16, 4.17 }- , containers ^>= { 0.6 }+ , base ^>= { 4.14, 4.16, 4.17, 4.19 }+ , containers ^>= { 0.6, 0.7 } , mtl ^>= { 2.2, 2.3 }- , primitive ^>= { 0.7, 0.8 }+ , primitive ^>= { 0.7, 0.8, 0.9 } , resourcet ^>= { 1.3 } , safe-exceptions ^>= { 0.1 } , transformers ^>= { 0.5, 0.6 }
src/Control/Monad/With.hs view
@@ -5,6 +5,7 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE InstanceSigs #-} {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-}@@ -40,6 +41,7 @@ import Control.Monad.Trans.Resource.Internal import qualified Control.Monad.Writer.Lazy as L import Control.Monad.Writer.Strict+import Data.Coerce import Data.Exceptable import Data.Functor import Data.Functor.Identity@@ -57,7 +59,7 @@ 'IO', 'ST', and 'Identity' allow for writing monad-generic exception-safe code which can be properly instantiated in 'IO' or mocked out in 'ST'/'Identity' without changing the code. -}-class Monad m ⇒ MonadWith m where+class (Monad m, ∀ x y. Coercible x y ⇒ Coercible (m x) (m y)) ⇒ MonadWith m where -- | Data characterizing exceptional exit from the scope. type WithException m @@ -174,7 +176,7 @@ -} newtype WithNoContinuation m a = WithNoContinuation (m a) deriving newtype (Functor, Applicative, Monad) -instance (Monad m) ⇒ MonadWith (WithNoContinuation m) where+instance (Monad m, ∀ x y. Coercible x y ⇒ Coercible (m x) (m y)) ⇒ MonadWith (WithNoContinuation m) where type WithException (WithNoContinuation m) = Void stateThreadingGeneralWith (GeneralAllocate allocA) go = WithNoContinuation $ do let WithNoContinuation allocA' = allocA id
src/Control/Monad/With.hs-boot view
@@ -1,12 +1,14 @@+{-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UnicodeSyntax #-} module Control.Monad.With where import Control.Exception.Safe+import Data.Coerce import {-# SOURCE #-} Data.GeneralAllocate -class Monad m ⇒ MonadWith m where+class (Monad m, ∀ x y. Coercible x y ⇒ Coercible (m x) (m y)) ⇒ MonadWith m where type WithException m type WithException m = SomeException stateThreadingGeneralWith