packages feed

bluefin-internal 0.0.12.0 → 0.0.13.0

raw patch · 2 files changed

+50/−11 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Bluefin.Internal.Examples: DynamicReader :: (forall e'. Eff (e' :& e) r) -> (forall e' a. (r -> r) -> Eff e' a -> Eff (e' :& e) a) -> DynamicReader r e
+ Bluefin.Internal.Examples: [askLRImpl] :: DynamicReader r e -> forall e'. Eff (e' :& e) r
+ Bluefin.Internal.Examples: [localLRImpl] :: DynamicReader r e -> forall e' a. (r -> r) -> Eff e' a -> Eff (e' :& e) a
+ Bluefin.Internal.Examples: askLR :: e :> es => DynamicReader r e -> Eff es r
+ Bluefin.Internal.Examples: data DynamicReader r e
+ Bluefin.Internal.Examples: instance Bluefin.Internal.Handle (Bluefin.Internal.Examples.DynamicReader r)
+ Bluefin.Internal.Examples: localLR :: e :> es => DynamicReader r e -> (r -> r) -> Eff es a -> Eff es a
+ Bluefin.Internal.Examples: runDynamicReader :: r -> (forall e. DynamicReader r e -> Eff (e :& es) a) -> Eff es a

Files

bluefin-internal.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               bluefin-internal-version:            0.0.12.0+version:            0.0.13.0 license:            MIT license-file:       LICENSE author:             Tom Ellis
src/Bluefin/Internal/Examples.hs view
@@ -3,7 +3,7 @@  module Bluefin.Internal.Examples where -import Bluefin.Internal hiding (w)+import Bluefin.Internal hiding (b, w) import Bluefin.Internal.Pipes   ( Producer,     runEffect,@@ -261,11 +261,11 @@             (\_ -> effIO io (putStrLn "Leaving 2"))             $ \_ -> do               for_ [1 :: Int .. 100] $ \n -> do-                b' <- await r+                b <- await r                 effIO                   io                   ( putStrLn-                      ("Consumed body " ++ show b' ++ " at time " ++ show n)+                      ("Consumed body " ++ show b ++ " at time " ++ show n)                   )               pure "Consumer finished first"       )@@ -332,11 +332,11 @@             $ \_ -> do               effIO io (putStrLn ("Consumed intial " ++ show binit))               for_ [1 :: Int .. 100] $ \n -> do-                b' <- await r+                b <- await r                 effIO                   io                   ( putStrLn-                      ("Consumed body " ++ show b' ++ " at time " ++ show n)+                      ("Consumed body " ++ show b ++ " at time " ++ show n)                   )               pure "Consumer finished first"       )@@ -834,7 +834,6 @@ -- > exampleCounter7B -- (["Count was even","Count was even","Count was even","Count was even","Count was even","Count was even"],-42) - -- FileSystem  data FileSystem es = MkFileSystem@@ -843,10 +842,11 @@   }  instance Handle FileSystem where-  mapHandle fs = MkFileSystem {-    readFileImpl = \fp -> useImplUnder (readFileImpl fs fp),-    writeFileImpl = \fp s -> useImplUnder (writeFileImpl fs fp s)-    }+  mapHandle fs =+    MkFileSystem+      { readFileImpl = \fp -> useImplUnder (readFileImpl fs fp),+        writeFileImpl = \fp s -> useImplUnder (writeFileImpl fs fp s)+      }  readFile :: (e :> es) => FileSystem e -> FilePath -> Eff es String readFile fs filepath = makeOp (readFileImpl (mapHandle fs) filepath)@@ -1021,3 +1021,42 @@   effIO io $ putStrLn $ case r of     Left e -> "Caught IOException:\n" ++ show e     Right contents -> contents++data DynamicReader r e = DynamicReader+  { askLRImpl :: forall e'. Eff (e' :& e) r,+    localLRImpl :: forall e' a. (r -> r) -> Eff e' a -> Eff (e' :& e) a+  }++instance Handle (DynamicReader r) where+  mapHandle h =+    DynamicReader+      { askLRImpl = useImplUnder (askLRImpl h),+        localLRImpl = \f k -> useImplUnder (localLRImpl h f k)+      }++askLR ::+  (e :> es) =>+  DynamicReader r e ->+  Eff es r+askLR c = makeOp (askLRImpl (mapHandle c))++localLR ::+  (e :> es) =>+  DynamicReader r e ->+  (r -> r) ->+  Eff es a ->+  Eff es a+localLR c f m = makeOp (localLRImpl (mapHandle c) f m)++runDynamicReader ::+  r ->+  (forall e. DynamicReader r e -> Eff (e :& es) a) ->+  Eff es a+runDynamicReader r k =+  runReader r $ \h -> do+    useImplIn+      k+      DynamicReader+        { askLRImpl = ask h,+          localLRImpl = \f k' -> makeOp (local h f (useImpl k'))+        }