packages feed

bluefin 0.0.10.0 → 0.0.11.0

raw patch · 4 files changed

+124/−12 lines, 4 filesdep ~bluefin-internalPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: bluefin-internal

API changes (from Hackage documentation)

+ Bluefin.Compound: makeOp :: forall (e :: Effects) r. Eff (e :& e) r -> Eff e r
+ Bluefin.Compound: useImplUnder :: forall (e :: Effects) (es :: Effects) (e1 :: Effects) r. e :> es => Eff (e1 :& e) r -> Eff (e1 :& es) r
+ Bluefin.IO: withEffToIO_ :: forall (e :: Effects) (es :: Effects) a. e :> es => IOE e -> ((forall r. () => Eff es r -> IO r) -> IO a) -> Eff es a

Files

CHANGELOG.md view
@@ -1,3 +1,9 @@+## 0.0.11.0++* Add `withEffToIO_`, `useImplUnder`, `makeOp`++* Soft deprecate `withEffToIO`, `useImplWithin`+ ## 0.0.10.0  * Add `Bluefin.System.IO`
bluefin.cabal view
@@ -1,6 +1,6 @@ cabal-version:      3.0 name:               bluefin-version:            0.0.10.0+version:            0.0.11.0 license:            MIT license-file:       LICENSE author:             Tom Ellis@@ -38,6 +38,6 @@       Bluefin.System.IO,       Bluefin.Writer,     build-depends:-      bluefin-internal >= 0.0.10.0 && < 0.1+      bluefin-internal >= 0.0.11.0 && < 0.1     hs-source-dirs:   src     default-language: Haskell2010
src/Bluefin/Compound.hs view
@@ -212,15 +212,22 @@     --     -- @     -- data Counter5 e = MkCounter5-    --   { incCounter5Impl :: Eff e (),-    --     getCounter5Impl :: String -> Eff e Int+    --   { incCounter5Impl :: forall e'. Eff (e' :& e) (),+    --     getCounter5Impl :: forall e'. String -> Eff (e' :& e) Int     --   }     --+    -- instance Handle Counter5 where+    --   mapHandle c =+    --     MkCounter5+    --       { incCounter5Impl = useImplUnder (incCounter5Impl c),+    --         getCounter5Impl = \\msg -> useImplUnder (getCounter5Impl c msg)+    --       }+    --     -- incCounter5 :: (e :> es) => Counter5 e -> Eff es ()-    -- incCounter5 e = useImpl (incCounter5Impl e)+    -- incCounter5 e = makeOp (incCounter5Impl (mapHandle e))     --     -- getCounter5 :: (e :> es) => Counter5 e -> String -> Eff es Int-    -- getCounter5 e msg = useImpl (getCounter5Impl e msg)+    -- getCounter5 e msg = makeOp (getCounter5Impl (mapHandle e) msg)     --     -- runCounter5 ::     --   (e1 :> es) =>@@ -278,13 +285,21 @@     --     -- @     -- data Counter6 e = MkCounter6-    --   { incCounter6Impl :: Eff e (),+    --   { incCounter6Impl :: forall e'. Eff (e' :& e) (),     --     counter6State :: State Int e,     --     counter6Stream :: Stream String e     --   }     --+    -- instance Handle Counter6 where+    --   mapHandle c =+    --     MkCounter6+    --       { incCounter6Impl = useImplUnder (incCounter6Impl c),+    --         counter6State = mapHandle (counter6State c),+    --         counter6Stream = mapHandle (counter6Stream c)+    --       }+    --     -- incCounter6 :: (e :> es) => Counter6 e -> Eff es ()-    -- incCounter6 e = useImpl (incCounter6Impl e)+    -- incCounter6 e = makeOp (incCounter6Impl (mapHandle e))     --     -- getCounter6 :: (e :> es) => Counter6 e -> String -> Eff es Int     -- getCounter6 (MkCounter6 _ st y) msg = do@@ -337,6 +352,95 @@     -- (["Count was even","I'm getting the counter","n was 2, as expected"],2)     -- @ +    -- ** Dynamic effects with handles as arguments++    -- | We can implement dynamic effects that themselves take handles+    -- as arguments, by giving all the handle arguments the effect tag+    -- @e'@.+    --+    -- @+    -- data Counter7 e = MkCounter7+    --   { incCounter7Impl :: forall e'. Exception () e' -> Eff (e' :& e) (),+    --     counter7State :: State Int e,+    --     counter7Stream :: Stream String e+    --   }+    --+    -- instance Handle Counter7 where+    --   mapHandle c =+    --     MkCounter7+    --       { incCounter7Impl = \\ex -> useImplUnder (incCounter7Impl c ex),+    --         counter7State = mapHandle (counter7State c),+    --         counter7Stream = mapHandle (counter7Stream c)+    --       }+    --+    -- incCounter7 ::+    --   (e :> es, e1 :> es) => Counter7 e -> Exception () e1 -> Eff es ()+    -- incCounter7 e ex = makeOp (incCounter7Impl (mapHandle e) (mapHandle ex))+    --+    -- getCounter7 :: (e :> es) => Counter7 e -> String -> Eff es Int+    -- getCounter7 (MkCounter7 _ st y) msg = do+    --   yield y msg+    --   get st+    --+    -- runCounter7 ::+    --   (e1 :> es) =>+    --   Stream String e1 ->+    --   (forall e. Counter7 e -> Eff (e :& es) r) ->+    --   Eff es Int+    -- runCounter7 y k =+    --   evalState 0 $ \\st -> do+    --     _ \<-+    --       useImplIn+    --         k+    --         ( MkCounter7+    --             { incCounter7Impl = \\ex -> do+    --                 count \<- get st+    --+    --                 when (even count) $+    --                   yield y "Count was even"+    --+    --                 when (count >= 10) $+    --                   throw ex ()+    --+    --                 put st (count + 1),+    --               counter7State = mapHandle st,+    --               counter7Stream = mapHandle y+    --             }+    --         )+    --     get st+    -- @+    --+    -- The result is the same as before ...+    --+    -- @+    -- exampleCounter7A :: ([String], Int)+    -- exampleCounter7A = runPureEff $ yieldToList $ \\y -> do+    --   handle (\\() -> pure (-42)) $ \\ex ->+    --     runCounter7 y $ \\c -> do+    --       incCounter7 c ex+    --       incCounter7 c ex+    --       n \<- getCounter7 c "I'm getting the counter"+    --       when (n == 2) $+    --         yield y "n was 2, as expected"+    --+    -- -- > exampleCounter7A+    -- -- (["Count was even","I'm getting the counter","n was 2, as expected"],2)+    -- @+    --+    -- ... unless we run @incCounter@ too many times, in which case it+    -- throws can exception.+    --+    -- @+    -- exampleCounter7B :: ([String], Int)+    -- exampleCounter7B = runPureEff $ yieldToList $ \\y -> do+    --   handle (\\() -> pure (-42)) $ \\ex ->+    --     runCounter7 y $ \\c -> do+    --       forever (incCounter7 c ex)+    --+    -- -- > exampleCounter7B+    -- -- (["Count was even","Count was even","Count was even","Count was even","Count was even","Count was even"],-42)+    -- @+     -- ** A dynamic file system effect      -- | The @effectful@ library has [an example of a dynamic effect@@ -454,19 +558,19 @@     -- @      -- * Functions for making compound effects-     Handle (mapHandle),+    makeOp,     useImpl,+    useImplUnder,     useImplIn,-    useImplWithin,      -- * Deprecated      -- | Do not use.  Will be removed in a future version.-     Compound,     runCompound,     withCompound,+    useImplWithin,   ) where 
src/Bluefin/IO.hs view
@@ -10,11 +10,13 @@     rethrowIO,     -- * IO type classes     withMonadIO,-    withEffToIO,+    withEffToIO_,     -- ** @EffReader@     EffReader,     effReader,     runEffReader,+    -- ** Deprecated versions+    withEffToIO,   ) where