bluefin-internal 0.5.100.0 → 0.6.0.0
raw patch · 5 files changed
+37/−30 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- Bluefin.Internal: runEff :: (forall (e :: Effects) (es :: Effects). () => IOE e -> Eff (e :& es) a) -> IO a
+ Bluefin.Internal: runEff :: (forall (e :: Effects). () => IOE e -> Eff e a) -> IO a
Files
- CHANGELOG.md +10/−0
- bluefin-internal.cabal +1/−1
- src/Bluefin/Internal.hs +9/−12
- src/Bluefin/Internal/Examples.hs +16/−16
- test/Main.hs +1/−1
CHANGELOG.md view
@@ -1,8 +1,18 @@+# 0.6.0.0++* Changed type of `runEff` to match `runEff_`++# 0.5.100.0+ * Add exports for change to "capability" nomenclature # 0.5.1.0 * Add `<:` type synonym for `:>`++# 0.6.0.0++* Changed type of `runEff` to match `runEff_` # 0.5.0.0
bluefin-internal.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: bluefin-internal-version: 0.5.100.0+version: 0.6.0.0 license: MIT license-file: LICENSE author: Tom Ellis
src/Bluefin/Internal.hs view
@@ -238,7 +238,7 @@ -- | Run `MonadIO` operations in 'Eff'. -- -- @--- >>> runEff_ $ \\io -> withMonadIO io $ liftIO $ do+-- >>> runEff $ \\io -> withMonadIO io $ liftIO $ do -- putStrLn "Hello world!" -- Hello, world! -- @@@ -277,7 +277,7 @@ -- | Run an 'Eff' that doesn't contain any unhandled effects. runPureEff :: (forall es. Eff es a) -> a-runPureEff e = unsafePerformIO (runEff_ (\_ -> e))+runPureEff e = unsafePerformIO (runEff (\_ -> e)) unsafeCoerceEff :: Eff t r -> Eff t' r unsafeCoerceEff = coerce@@ -799,7 +799,7 @@ -- due to pure exceptions being imprecise. -- -- f :: IO (Either Ex1 (Either Ex2 a))--- f = runEff_ $ \io -> do+-- f = runEff $ \io -> do -- try $ \e1 -> do -- try $ \e2 -> do -- rethrowIO io e1 $ do@@ -1481,7 +1481,7 @@ -- | Run an 'IO' operation in 'Eff' -- -- @--- >>> runEff_ $ \\io -> do+-- >>> runEff $ \\io -> do -- effIO io (putStrLn "Hello world!") -- Hello, world! -- @@@ -1496,18 +1496,15 @@ -- | Run an 'Eff' whose only unhandled effect is 'IO'. -- -- @--- >>> runEff_ $ \\io -> do+-- >>> runEff $ \\io -> do -- effIO io (putStrLn "Hello world!") -- Hello, world! -- @------ We suggest you use 'runEff_' instead, as it probably has better--- type inference properties. runEff ::- (forall e es. IOE e -> Eff (e :& es) a) ->+ (forall e. IOE e -> Eff e a) -> -- | ͘ IO a-runEff eff = runEff_ (makeOp . eff)+runEff eff = runEff_ eff -- | Run an 'Eff' whose only unhandled effect is 'IO'. --@@ -1517,8 +1514,8 @@ -- Hello, world! -- @ ----- This probably has better type inference properties than 'runEff'--- and so will probably replace it in a later version.+-- Use 'runEff' instead. @runEff_@ will be deprecated in a future+-- version. runEff_ :: (forall e. IOE e -> Eff e a) -> -- | ͘
src/Bluefin/Internal/Examples.hs view
@@ -35,7 +35,7 @@ import Prelude qualified monadIOExample :: IO ()-monadIOExample = runEff_ $ \io -> withMonadIO io $ liftIO $ do+monadIOExample = runEff $ \io -> withMonadIO io $ liftIO $ do name <- readLn putStrLn ("Hello " ++ name) @@ -133,7 +133,7 @@ pure "End of loop" effIOExample :: IO ()-effIOExample = runEff_ $ \io -> do+effIOExample = runEff $ \io -> do effIO io (putStrLn "Hello world!") example1_ :: (Int, Int)@@ -181,7 +181,7 @@ -- Count non-empty lines from stdin, and print a friendly message, -- until we see "STOP". example3_ :: IO ()-example3_ = runEff_ $ \io -> do+example3_ = runEff $ \io -> do let getLineUntilStop y = withJump $ \stop -> forever $ do line <- effIO io getLine when (line == "STOP") $@@ -272,12 +272,12 @@ useImplUnder . x awaitExample :: IO ()-awaitExample = runEff_ $ \io -> do+awaitExample = runEff $ \io -> do awaitList [1 :: Int ..] io $ awaitUsage io $ \rec -> do replicateM_ 5 (await rec) consumeStreamExample :: IO (Either String String)-consumeStreamExample = runEff_ $ \io -> do+consumeStreamExample = runEff $ \io -> do try $ \ex -> do consumeStream ( \r ->@@ -309,7 +309,7 @@ ) consumeStreamExample2 :: IO ()-consumeStreamExample2 = runEff_ $ \io -> do+consumeStreamExample2 = runEff $ \io -> do let counter yeven yodd = for_ [0 :: Int .. 10] $ \i -> do if even i then yield yeven i@@ -334,7 +334,7 @@ bar connectExample :: IO (Either String String)-connectExample = runEff_ $ \io -> do+connectExample = runEff $ \io -> do try $ \ex -> do connectCoroutines ( \y -> bracket@@ -367,7 +367,7 @@ ) zipCoroutinesExample :: IO ()-zipCoroutinesExample = runEff_ $ \io -> do+zipCoroutinesExample = runEff $ \io -> do let m1 y = do r <- yieldCoroutine y 1 evalModify r $ \rs -> do@@ -447,7 +447,7 @@ myBail h countExample :: IO ()-countExample = runEff_ $ \io -> do+countExample = runEff $ \io -> do evalModify @Int 0 $ \sn -> do withJump $ \break -> forever $ do n <- get sn@@ -505,7 +505,7 @@ modify state (+ i) runIncrementReadLine :: IO (Either String Int)-runIncrementReadLine = runEff_ $ \io -> do+runIncrementReadLine = runEff $ \io -> do try $ \exception -> do ((), r) <- runModify 0 $ \state -> do incrementReadLine state exception io@@ -607,7 +607,7 @@ runCounter3B io k = useImplIn k (MkCounter3B (mapHandle io)) exampleCounter3B :: IO ()-exampleCounter3B = runEff_ $ \io -> runCounter3B io $ \c -> do+exampleCounter3B = runEff $ \io -> runCounter3B io $ \c -> do incCounter3B c incCounter3B c incCounter3B c@@ -936,7 +936,7 @@ -- Left "File not found: /tmp/doesn't exist" exampleRunFileSystemIO :: IO (Either String String)-exampleRunFileSystemIO = runEff_ $ \io -> try $ \ex ->+exampleRunFileSystemIO = runEff $ \io -> try $ \ex -> runFileSystemIO ex io action -- > exampleRunFileSystemIO@@ -988,13 +988,13 @@ pure st pipesExample1 :: IO ()-pipesExample1 = runEff_ $ \io -> runEffect (count >-> P.print io)+pipesExample1 = runEff $ \io -> runEffect (count >-> P.print io) where count :: (e <: es) => Producer Int e -> Eff es () count p = for_ [1 .. 5] $ \i -> P.yield p i pipesExample2 :: IO String-pipesExample2 = runEff_ $ \io -> runEffect $ do+pipesExample2 = runEff $ \io -> runEffect $ do stdinLn io >-> takeWhile' (/= "quit") >-> stdoutLn io -- Acquiring resource@@ -1006,7 +1006,7 @@ -- Releasing resource -- Finishing promptCoroutine :: IO ()-promptCoroutine = runEff_ $ \io -> do+promptCoroutine = runEff $ \io -> do -- consumeStream connects a consumer to a producer consumeStream -- Like a pipes Consumer. Prints the first five elements it@@ -1027,7 +1027,7 @@ effIO io (putStrLn "Finishing") rethrowIOExample :: IO ()-rethrowIOExample = runEff_ $ \io -> do+rethrowIOExample = runEff $ \io -> do r <- try $ \ex -> do rethrowIO @Control.Exception.IOException io ex $ do effIO io (Prelude.readFile "/tmp/doesnt-exist")
test/Main.hs view
@@ -11,7 +11,7 @@ import Prelude hiding (break, read) main :: IO ()-main = runEff_ $ \io -> do+main = runEff $ \io -> do runSpecH io $ \y -> do let assertEqual' = assertEqual y