bluefin 0.2.5.0 → 0.2.6.0
raw patch · 5 files changed
+37/−12 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Bluefin.Exception.GeneralBracket: abstract :: forall h2 h1 (es :: Effects). Handle h2 => (forall (e :: Effects). () => h1 e -> h2 (e :& es)) -> (h1 :~> h2) es
+ Bluefin.Exception.GeneralBracket: apMakeExceptions :: forall (h1 :: Effects -> Type) (h2 :: Effects -> Type) r a (e :: Effects). (Handle h1, Handle h2) => MakeExceptions r a (h1 :~> h2) e -> MakeExceptions r a h1 e -> MakeExceptions r a h2 e
+ Bluefin.Exception.GeneralBracket: catchWithResource :: forall ex r a (es :: Effects). (r -> ex -> Eff es a) -> MakeExceptions r a (Exception ex) es
+ Bluefin.Exception.GeneralBracket: data ( (h1 :: Effects -> Type) :~> (h2 :: Effects -> Type) ) (es :: Effects)
+ Bluefin.Exception.GeneralBracket: data MakeExceptions r a (h :: Effects -> Type) (es :: Effects)
+ Bluefin.Exception.GeneralBracket: fmapMakeExceptions :: forall (h1 :: Effects -> Type) (h2 :: Effects -> Type) (e :: Effects) r a. (Handle h1, Handle h2) => (h1 :~> h2) e -> MakeExceptions r a h1 e -> MakeExceptions r a h2 e
+ Bluefin.Exception.GeneralBracket: generalBracket :: forall r b h a (es :: Effects). Handle h => Eff es r -> MakeExceptions r a h es -> (r -> b -> Eff es a) -> (r -> Eff es ()) -> (forall (e :: Effects). () => h e -> r -> Eff (e :& es) b) -> Eff es a
+ Bluefin.Exception.GeneralBracket: infixr 9 :~>
+ Bluefin.Exception.GeneralBracket: pureMakeExceptions :: forall h (e :: Effects) r a. h e -> MakeExceptions r a h e
Files
- CHANGELOG.md +4/−0
- bluefin.cabal +2/−1
- src/Bluefin.hs +11/−10
- src/Bluefin/Exception/GeneralBracket.hs +19/−0
- src/Bluefin/StateSource.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,7 @@+# 0.2.6.0++* Add `Bluefin.Exception.GeneralBracket`, thanks to Shea Levy+ # 0.2.5.0 * Add `finally`
bluefin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: bluefin-version: 0.2.5.0+version: 0.2.6.0 license: MIT license-file: LICENSE author: Tom Ellis@@ -29,6 +29,7 @@ Bluefin.EarlyReturn, Bluefin.Eff, Bluefin.Exception,+ Bluefin.Exception.GeneralBracket, Bluefin.HandleReader, Bluefin.IO, Bluefin.Jump,
src/Bluefin.hs view
@@ -113,11 +113,12 @@ -- systems](https://www.youtube.com/watch?v=RsTuy1jXQ6Y)" by Tom -- Ellis (recorded at Zurihac 2025). --- -- The short answer is: 'Control.Monad.Monad's. @Monad@ is a+ -- The short answer is: t'Control.Monad.Monad's. @Monad@ is a -- general interface that permits ordering of operations. -- Instances of @Monad@ from early in the development of Haskell- -- include 'Prelude.IO', 'Control.Monad.Trans.State.State',- -- 'Prelude.Either' and 'Control.Monad.Trans.State.Writer', all of+ -- include t'Prelude.IO',+ -- t'Control.Monad.Trans.State.Strict.State', t'Prelude.Either'+ -- and t'Control.Monad.Trans.Writer.CPS.Writer', all of -- which are still in use today. For example, to manipulate -- mutable state we can't use @let@ bindings in the following way: --@@ -148,7 +149,7 @@ -- in "Final value: " ++ v -- @ --- -- Moreover, we can define a 'Control.Monad.Trans.State.State'+ -- Moreover, we can define a t'Control.Monad.Trans.State.Strict.State' -- monad which casts the ad hoc state passing pattern as a general -- pattern known as "monad": --@@ -186,10 +187,10 @@ -- [@transformers@](https://hackage.haskell.org/package/transformers) -- and [@mtl@](https://hackage.haskell.org/package/mtl) libraries. -- The transformer extensions of @State@ and @Either@ are- -- 'Control.Monad.Trans.State.StateT' and- -- 'Control.Monad.Trans.State.ExceptT', and the @Mt@ extensions- -- are 'Control.Monad.State.MonadState' and- -- 'Control.Monad.Error.MonadError'. We won't go into more detail+ -- t'Control.Monad.Trans.State.Strict.StateT' and+ -- t'Control.Monad.Trans..ExceptT', and the @Mt@ extensions+ -- are t'Control.Monad.State.Strict.MonadState' and+ -- t'Control.Monad.Except.MonadError'. We won't go into more detail -- here because this documentation isn't a transformers or MTL -- tutorial, but here is an example of an MTL-style function that -- uses those two effects, and no others:@@ -419,7 +420,7 @@ -- If we get the best of both worlds with analytic effect systems, -- is there a downside? Yes, the downside is that analytic effect -- systems do not support multishot continuations, like- -- 'Control.Monad.Logic.LogicT' implements. Here's an example of+ -- t'Control.Monad.Logic.LogicT' implements. Here's an example of -- using multishot continuations to calculate all sums of paths -- from root to leaf in a tree. In the @Branch@ alternative, -- @allSums t@ is a "multishot" continuation because it is run@@ -867,7 +868,7 @@ -- type parameters which track which effects can be used in an -- operation. Bluefin uses them to ensure that effects cannot -- escape the scope of their handler, in the same way that the- -- type parameter to the 'Control.Monad.ST.ST' monad ensures that+ -- type parameter to the t'Control.Monad.ST.ST' monad ensures that -- mutable state references cannot escape -- 'Control.Monad.ST.runST'. When the type system indicates that -- there are no unhandled effects it is safe to run the underlying
+ src/Bluefin/Exception/GeneralBracket.hs view
@@ -0,0 +1,19 @@+module Bluefin.Exception.GeneralBracket+ ( -- * Effectful functions+ generalBracket,++ -- * Handle+ MakeExceptions,+ catchWithResource,+ pureMakeExceptions,+ apMakeExceptions,+ fmapMakeExceptions,++ -- * @:~>@+ (:~>),+ abstract,+ )+where++import Bluefin.Internal.CloneableHandle+import Bluefin.Internal.Exception
src/Bluefin/StateSource.hs view
@@ -1,6 +1,6 @@ module Bluefin.StateSource ( -- | A 'StateSource' allows you to allocate new- -- 'Bluefin.State.State' handles, much like 'Control.Monad.ST'+ -- t'Bluefin.State.State' handles, much like t'Control.Monad.ST' -- allows you to allocate new 'Data.STRef.STRef's. This can be -- useful when you want to avoid nested 'Bluefin.State.runState' -- (or `Bluefin.State.evalState') blocks, or you need a number