bluefin 0.0.17.0 → 0.0.17.1
raw patch · 3 files changed
+67/−3 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Bluefin.Compound: class () => Handle (h :: Effects -> Type)
+ Bluefin.Compound: class Handle (h :: Effects -> Type)
- Bluefin.Compound: data () => Compound (e1 :: Effects -> Type) (e2 :: Effects -> Type) (ss :: Effects)
+ Bluefin.Compound: data Compound (e1 :: Effects -> Type) (e2 :: Effects -> Type) (ss :: Effects)
- Bluefin.Coroutine: data () => Coroutine a b (e :: Effects)
+ Bluefin.Coroutine: data Coroutine a b (e :: Effects)
- Bluefin.Eff: class () => (es1 :: Effects) :> (es2 :: Effects)
+ Bluefin.Eff: class (es1 :: Effects) :> (es2 :: Effects)
- Bluefin.Eff: data () => Eff (es :: Effects) a
+ Bluefin.Eff: data Eff (es :: Effects) a
- Bluefin.Eff: data () => Effects
+ Bluefin.Eff: data Effects
- Bluefin.Exception: data () => Exception exn (e :: Effects)
+ Bluefin.Exception: data Exception exn (e :: Effects)
- Bluefin.HandleReader: data () => HandleReader (h :: Effects -> Type) (e :: Effects)
+ Bluefin.HandleReader: data HandleReader (h :: Effects -> Type) (e :: Effects)
- Bluefin.IO: data () => EffReader r (es :: Effects) a
+ Bluefin.IO: data EffReader r (es :: Effects) a
- Bluefin.IO: data () => IOE (e :: Effects)
+ Bluefin.IO: data IOE (e :: Effects)
- Bluefin.Pipes: data () => Proxy a' a b' b (e :: Effects)
+ Bluefin.Pipes: data Proxy a' a b' b (e :: Effects)
- Bluefin.Reader: data () => Reader r (e :: Effects)
+ Bluefin.Reader: data Reader r (e :: Effects)
- Bluefin.State: data () => State s (e :: Effects)
+ Bluefin.State: data State s (e :: Effects)
- Bluefin.StateSource: data () => StateSource (e :: Effects)
+ Bluefin.StateSource: data StateSource (e :: Effects)
- Bluefin.System.IO: data () => Handle (e :: Effects)
+ Bluefin.System.IO: data Handle (e :: Effects)
- Bluefin.Writer: data () => Writer w (e :: Effects)
+ Bluefin.Writer: data Writer w (e :: Effects)
Files
- CHANGELOG.md +4/−0
- bluefin.cabal +2/−2
- src/Bluefin.hs +61/−1
CHANGELOG.md view
@@ -1,3 +1,7 @@+## 0.0.17.1++* Documentation only, thanks to @ShilohAlleyne+ ## 0.0.17.0 * Added `streamConsume`, `cycleToStream`, `takeConsume` (thanks to
bluefin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: bluefin-version: 0.0.17.0+version: 0.0.17.1 license: MIT license-file: LICENSE author: Tom Ellis@@ -39,6 +39,6 @@ Bluefin.System.IO, Bluefin.Writer, build-depends:- bluefin-internal >= 0.0.13.0 && < 0.2+ bluefin-internal >= 0.1.1.0 && < 0.2 hs-source-dirs: src default-language: Haskell2010
src/Bluefin.hs view
@@ -647,7 +647,67 @@ -- "Control.Monad.ST": it ensures that a handle can never escape -- the scope of its handler. That is, once the handler has -- finished running there is no way you can use the handle- -- anymore.+ -- anymore. For an example of a correctly-scoped function see+ -- @correctlyScoped@ below. It uses Bluefin’s @State@ handle to+ -- compute the sum of the numbers 1 to 10, before multiplying the+ -- result by 20. In @correctlyScoped@ the @State@ handle is scoped+ -- to its handler, @evalState@, and everything works as expected:+ --+ -- @+ -- -- /Result: 1100/+ -- correctlyScoped :: Eff es Integer+ -- correctlyScoped = do+ -- -- /Initial state 0/+ -- r \<- 'Bluefin.State.evalState' 0 $ \\st -> do+ -- -- The 'Bluefin.State.State' handle "st" is scoped to the+ -- -- handler that introduced it, evalState,+ -- -- and therefore it can only be used within+ -- -- this do block.+ --+ -- -- /Add up the numbers 1 to 10/+ -- for_ [1..10] $ \\i -> do+ -- 'Bluefin.State.modify' st (+ i)+ --+ -- -- /Get the result/+ -- 'Bluefin.State.get' st+ --+ -- pure (r * 20)+ -- @+ --+ -- Now let's look at an incorrectly-scoped example,+ -- @incorrectlyScoped@. It attempts to pass the state handle @st@+ -- out of the scope of @evalState@:+ --+ -- @+ -- incorrectlyScoped :: Eff es Integer+ -- incorrectlyScoped = do+ -- -- /Initial state 0/+ -- (total, st) \<- 'Bluefin.State.evalState' 0 $ \\st -> do+ -- -- /Add up the numbers 1 to 10/+ -- for_ [1..10] $ \\i -> do+ -- 'Bluefin.State.modify' st (+ i)+ --+ -- -- /Get the result/+ -- r <- 'Bluefin.State.get' st+ --+ -- -- /Pass out the result, and try to pass the/+ -- -- /'Bluefin.State.State' handle outside its scope, i.e. this/+ -- -- /do block introduced by evalState/+ -- pure (r, st)+ --+ -- modify st (* 20)+ -- get st+ -- @+ --+ -- The type system prevents us from passing the @State@ handle out+ -- of its scope, giving this error message:+ --+ -- @+ -- • Couldn't match type ‘e0’ with ‘e’+ -- Expected: (Integer, State Integer e0)+ -- Actual: (Integer, State Integer e)+ -- because type variable ‘e’ would escape its scope+ -- @ -- ** Type signatures