bluefin 0.5.100.0 → 0.6.0.0
raw patch · 8 files changed
+47/−39 lines, 8 filesdep ~bluefin-internalPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bluefin-internal
API changes (from Hackage documentation)
- Bluefin.Eff: runEff :: (forall (e :: Effects) (es :: Effects). () => IOE e -> Eff (e :& es) a) -> IO a
+ Bluefin.Eff: runEff :: (forall (e :: Effects). () => IOE e -> Eff e a) -> IO a
- Bluefin.IO: runEff :: (forall (e :: Effects) (es :: Effects). () => IOE e -> Eff (e :& es) a) -> IO a
+ Bluefin.IO: runEff :: (forall (e :: Effects). () => IOE e -> Eff e a) -> IO a
Files
- CHANGELOG.md +6/−0
- bluefin.cabal +2/−2
- src/Bluefin.hs +3/−3
- src/Bluefin/CloneableHandle.hs +1/−1
- src/Bluefin/Compound.hs +30/−30
- src/Bluefin/Eff.hs +3/−1
- src/Bluefin/IO.hs +1/−1
- src/Bluefin/Pipes/Prelude.hs +1/−1
CHANGELOG.md view
@@ -1,3 +1,9 @@+# 0.6.0.0++* Changed type of `runEff` to match `runEff_`++# 0.5.100.0+ * Covert to "capability" nomenclature See module "Bluefin.Capability" for a guide to the new naming. Users
bluefin.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: bluefin-version: 0.5.100.0+version: 0.6.0.0 license: MIT license-file: LICENSE author: Tom Ellis@@ -56,6 +56,6 @@ Bluefin.System.IO, Bluefin.Writer, build-depends:- bluefin-internal >= 0.5.100.0 && < 0.6+ bluefin-internal >= 0.6 && < 0.7 hs-source-dirs: src default-language: Haskell2010
src/Bluefin.hs view
@@ -761,7 +761,7 @@ -- must be handled by a corresponding handler, for example -- 'Bluefin.Capability.Modify.runModify' for the state effect, -- 'Bluefin.Capability.Throw.try' for the exception effect and- -- 'Bluefin.Eff.runEff_' for the @IO@ effect. The type signatures+ -- 'Bluefin.Eff.runEff' for the @IO@ effect. The type signatures -- of handlers also follow a common pattern, which looks like -- -- @@@ -771,13 +771,13 @@ -- This means that the effect tag @e@, corresponding to the capability -- @\<Capability\> e@, has been handled and removed from the set of -- remaining effects, @es@. (The signatures for- -- 'Bluefin.Eff.runEff_' and 'Bluefin.Eff.runPureEff' are slightly+ -- 'Bluefin.Eff.runEff' and 'Bluefin.Eff.runPureEff' are slightly -- different because they remove @Eff@ itself.) Here, then, is -- how we can run @incrementReadLine@: -- -- @ -- runIncrementReadLine :: IO (Either String Int)- -- runIncrementReadLine = 'Bluefin.Eff.runEff_' $ \\io -> do+ -- runIncrementReadLine = 'Bluefin.Eff.runEff' $ \\io -> do -- 'Bluefin.Capability.Throw.try' $ \\exception -> do -- ((), r) \<- 'Bluefin.Capability.Modify.runModify' 0 $ \\state -> do -- incrementReadLine state exception io
src/Bluefin/CloneableHandle.hs view
@@ -38,7 +38,7 @@ -- -- @ -- example :: IO ()- -- example = 'Bluefin.Eff.runEff_' $ \\io -> 'Bluefin.State.evalState' 0 $ \\st -> do+ -- example = 'Bluefin.Eff.runEff' $ \\io -> 'Bluefin.State.evalState' 0 $ \\st -> do -- r \<- 'Bluefin.Exception.try' $ \\ex -> do -- bluefinRace -- io
src/Bluefin/Compound.hs view
@@ -20,7 +20,7 @@ -- (forall e. Counter1 e -> Eff (e :& es) r) -> -- Eff es Int -- runCounter1 k =- -- 'Bluefin.Modify.evalModify' 0 $ \\st -> do+ -- 'Bluefin.Capability.Modify.evalModify' 0 $ \\st -> do -- _ <- k (MkCounter1 st) -- 'Bluefin.Capability.Modify.get' st -- @@@ -53,23 +53,23 @@ -- an exception when we hit a limit. -- -- @- -- data Counter2 e1 e2 = MkCounter2 ('Bluefin.State.State' Int e1) ('Bluefin.Capability.Throw.Throw' () e2)+ -- data Counter2 e1 e2 = MkCounter2 ('Bluefin.Capability.Modify.Modify' Int e1) ('Bluefin.Capability.Throw.Throw' () e2) -- -- incCounter2 :: (e1 \<: es, e2 \<: es) => Counter2 e1 e2 -> 'Bluefin.Eff.Eff' es () -- incCounter2 (MkCounter2 st ex) = do -- count <- 'Bluefin.Capabiilty.Modify.get' st -- when (count >= 10) $ -- 'Bluefin.Capability.Throw.throw' ex ()- -- 'Bluefin.Modify.put' st (count + 1)+ -- 'Bluefin.Capability.Modify.put' st (count + 1) -- -- runCounter2 :: -- (forall e1 e2. Counter2 e1 e2 -> Eff (e2 :& e1 :& es) r) -> -- Eff es Int -- runCounter2 k =- -- 'Bluefin.Modify.evalState' 0 $ \\st -> do+ -- 'Bluefin.Capability.Modify.evalModify' 0 $ \\st -> do -- _ \<- 'Bluefin.Capability.Throw.try' $ \\ex -> do -- k (MkCounter2 st ex)- -- 'Bluefin.Modify.get' st+ -- 'Bluefin.Capability.Modify.get' st -- @ -- -- We can see that attempting to increment the counter fovever@@ -105,19 +105,19 @@ -- -- incCounter3 :: (e \<: es) => Counter3 e -> Eff es () -- incCounter3 (MkCounter3 st ex) = do- -- count <- 'Bluefin.Modify.get' st+ -- count <- 'Bluefin.Capability.Modify.get' st -- when (count >= 10) $ -- 'Bluefin.Capability.Throw.throw' ex ()- -- 'Bluefin.Modify.put' st (count + 1)+ -- 'Bluefin.Capability.Modify.put' st (count + 1) -- -- runCounter3 :: -- (forall e. Counter3 e -> Eff (e :& es) r) -> -- Eff es Int -- runCounter3 k =- -- 'Bluefin.Modify.evalState' 0 $ \\st -> do+ -- 'Bluefin.Capability.Modify.evalModify' 0 $ \\st -> do -- _ \<- 'Bluefin.Capability.Throw.try' $ \\ex -> do -- 'useImplIn' k (MkCounter3 ('mapHandle' st) (mapHandle ex))- -- 'Bluefin.Modify.get' st+ -- 'Bluefin.Capability.Modify.get' st -- @ -- -- The example works as before:@@ -141,7 +141,7 @@ -- though: we can leave an effect unhandled to be handled by a -- different handler at a higher level. This must /always/ be the -- case for 'Bluefin.IO.IOE', which can only be handled at the top- -- level by 'Bluefin.Eff.runEff_'. Let's see what it looks like to+ -- level by 'Bluefin.Eff.runEff'. Let's see what it looks like to -- wrap @IOE@ and provide an API which allows a subset of @IO@ -- operations. --@@ -162,7 +162,7 @@ -- -- @ -- exampleCounter3B :: IO ()- -- exampleCounter3B = 'Bluefin.Eff.runEff_' $ \\io -> runCounter3B io $ \\c -> do+ -- exampleCounter3B = 'Bluefin.Eff.runEff' $ \\io -> runCounter3B io $ \\c -> do -- incCounter3B c -- incCounter3B c -- incCounter3B c@@ -195,7 +195,7 @@ -- -- incCounter4 :: (e \<: es) => Counter4 e -> Eff es () -- incCounter4 (MkCounter4 st ex y) = do- -- count <- 'Bluefin.Modify.get' st+ -- count <- 'Bluefin.Capability.Modify.get' st -- -- when (even count) $ -- 'Bluefin.Stream.yield' y "Count was even"@@ -203,7 +203,7 @@ -- when (count >= 10) $ -- 'Bluefin.Capability.Throw.throw' ex () --- -- 'Bluefin.Modify.put' st (count + 1)+ -- 'Bluefin.Capability.Modify.put' st (count + 1) -- -- getCounter4 :: (e \<: es) => Counter4 e -> String -> Eff es Int -- getCounter4 (MkCounter4 st _ y) msg = do@@ -216,7 +216,7 @@ -- (forall e. Counter4 e -> Eff (e :& es) r) -> -- Eff es Int -- runCounter4 y k =- -- evalState 0 $ \\st -> do+ -- evalModify 0 $ \\st -> do -- _ \<- try $ \\ex -> do -- 'useImplIn' k (MkCounter4 ('mapHandle' st) (mapHandle ex) (mapHandle y)) -- get st@@ -276,13 +276,13 @@ -- (forall e. Counter5 e -> Eff (e :& es) r) -> -- Eff es Int -- runCounter5 y k =- -- 'Bluefin.Modify.evalState' 0 $ \\st -> do+ -- 'Bluefin.Capability.Modify.evalModify' 0 $ \\st -> do -- _ \<- 'Bluefin.Capability.Throw.try' $ \\ex -> do -- 'useImplIn' -- k -- ( MkCounter5 -- { incCounter5Impl = do- -- count <- 'Bluefin.Modify.get' st+ -- count <- 'Bluefin.Capability.Modify.get' st -- -- when (even count) $ -- 'Bluefin.Stream.yield' y "Count was even"@@ -290,7 +290,7 @@ -- when (count >= 10) $ -- 'Bluefin.Capability.Throw.throw' ex () --- -- 'Bluefin.Modify.put' st (count + 1),+ -- 'Bluefin.Capability.Modify.put' st (count + 1), -- getCounter5Impl = \\msg -> do -- yield y msg -- get st@@ -350,13 +350,13 @@ -- (forall e. Counter6 e -> Eff (e :& es) r) -> -- Eff es Int -- runCounter6 y k =- -- 'Bluefin.Modify.evalState' 0 $ \\st -> do+ -- 'Bluefin.Capability.Modify.evalModify' 0 $ \\st -> do -- _ \<- 'Bluefin.Capability.Throw.try' $ \\ex -> do -- 'useImplIn' -- k -- ( MkCounter6 -- { incCounter6Impl = do- -- count <- 'Bluefin.Modify.get' st+ -- count <- 'Bluefin.Capability.Modify.get' st -- -- when (even count) $ -- 'Bluefin.Stream.yield' y "Count was even"@@ -364,7 +364,7 @@ -- when (count >= 10) $ -- 'Bluefin.Capability.Throw.throw' ex () --- -- 'Bluefin.Modify.put' st (count + 1),+ -- 'Bluefin.Capability.Modify.put' st (count + 1), -- counter6State = mapHandle st, -- counter6Stream = mapHandle y -- }@@ -417,7 +417,7 @@ -- } -- -- incCounter7 ::- -- (e \<: es, e1 \<: es) => Counter7 e -> Exception () e1 -> Eff es ()+ -- (e \<: es, e1 \<: es) => Counter7 e -> Throw () e1 -> Eff es () -- incCounter7 e ex = 'makeOp' (incCounter7Impl ('mapHandle' e) (mapHandle ex)) -- -- getCounter7 :: (e \<: es) => Counter7 e -> String -> Eff es Int@@ -431,13 +431,13 @@ -- (forall e. Counter7 e -> Eff (e :& es) r) -> -- Eff es Int -- runCounter7 y k =- -- 'Bluefin.Modify.evalState' 0 $ \\st -> do+ -- 'Bluefin.Capability.Modify.evalModify' 0 $ \\st -> do -- _ \<- -- 'useImplIn' -- k -- ( MkCounter7 -- { incCounter7Impl = \\ex -> do- -- count \<- 'Bluefin.Modify.get' st+ -- count \<- 'Bluefin.Capability.Modify.get' st -- -- when (even count) $ -- 'Bluefin.Stream.yield' y "Count was even"@@ -445,7 +445,7 @@ -- when (count >= 10) $ -- 'Bluefin.Capability.Throw.throw' ex () --- -- 'Bluefin.Modify.put' st (count + 1),+ -- 'Bluefin.Capability.Modify.put' st (count + 1), -- counter7State = mapHandle st, -- counter7Stream = mapHandle y -- }@@ -575,23 +575,23 @@ -- @ -- runFileSystemPure :: -- (e1 \<: es) =>- -- Exception String e1 ->+ -- Throw String e1 -> -- [(FilePath, String)] -> -- (forall e2. FileSystem e2 -> Eff (e2 :& es) r) -> -- Eff es r -- runFileSystemPure ex fs0 k =- -- 'Bluefin.Modify.evalState' fs0 $ \\fs ->+ -- 'Bluefin.Capability.Modify.evalModify' fs0 $ \\fs -> -- 'useImplIn' -- k -- MkFileSystem -- { readFileImpl = \\filepath -> do- -- fs' <- 'Bluefin.Modify.get' fs+ -- fs' <- 'Bluefin.Capability.Modify.get' fs -- case lookup filepath fs' of -- Nothing -> -- 'Bluefin.Capability.Throw.throw' ex ("File not found: " <> filepath) -- Just s -> pure s, -- writeFileImpl = \\filepath contents ->- -- 'Bluefin.Modify.modify' fs ((filepath, contents) :)+ -- 'Bluefin.Capability.Modify.modify' fs ((filepath, contents) :) -- } -- @ --@@ -602,7 +602,7 @@ -- runFileSystemIO :: -- forall e1 e2 es r. -- (e1 \<: es, e2 \<: es) =>- -- Exception String e1 ->+ -- Throw String e1 -> -- IOE e2 -> -- (forall e. FileSystem e -> Eff (e :& es) r) -> -- Eff es r@@ -652,7 +652,7 @@ -- -- @ -- exampleRunFileSystemIO :: IO (Either String String)- -- exampleRunFileSystemIO = 'Bluefin.Eff.runEff_' $ \\io -> try $ \\ex ->+ -- exampleRunFileSystemIO = 'Bluefin.Eff.runEff' $ \\io -> try $ \\ex -> -- runFileSystemIO ex io action -- @ --
src/Bluefin/Eff.hs view
@@ -6,7 +6,6 @@ -- * Run an 'Eff' runPureEff,- runEff_, runEff, -- * Resource management@@ -26,6 +25,9 @@ (:>), type (<:), (:&),++ -- * Deprecated+ runEff_, ) where
src/Bluefin/IO.hs view
@@ -5,7 +5,6 @@ IOE, -- * Handlers- runEff_, runEff, -- * Effectful operations@@ -24,6 +23,7 @@ -- ** Deprecated versions withEffToIO,+ runEff_, ) where
src/Bluefin/Pipes/Prelude.hs view
@@ -19,7 +19,7 @@ -- See also "Bluefin.Pipes". -- -- @--- >>> 'Bluefin.Eff.runEff_' $ \\io -> 'runEffect' $ do+-- >>> 'Bluefin.Eff.runEff' $ \\io -> 'runEffect' $ do -- 'stdinLn' io >-> 'takeWhile'' (/= "quit") >-> 'stdoutLn' io -- Test -- Test