bluefin-internal 0.0.5.0 → 0.0.6.0
raw patch · 4 files changed
+32/−1 lines, 4 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
+ Bluefin.Internal: withYieldToList :: (forall e. Stream a e -> Eff (e :& es) ([a] -> r)) -> Eff es r
+ Bluefin.Internal.Examples: withYieldToListExample :: Int
Files
- CHANGELOG.md +6/−0
- bluefin-internal.cabal +1/−1
- src/Bluefin/Internal.hs +18/−0
- src/Bluefin/Internal/Examples.hs +7/−0
CHANGELOG.md view
@@ -1,8 +1,14 @@+## 0.0.6.0++* Add `withYieldToList`+ ## 0.0.5.0 * Fix roles on `Eff` (thanks to @Lysxia) * Add `bracket` (thanks to @Lysxia)++* Document `Jump` ## 0.0.4.2
bluefin-internal.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: bluefin-internal-version: 0.0.5.0+version: 0.0.6.0 license: MIT license-file: LICENSE author: Tom Ellis
src/Bluefin/Internal.hs view
@@ -777,6 +777,24 @@ (as, r) <- yieldToReverseList f pure (reverse as, r) +-- |+-- @+-- >>> runPureEff $ withYieldToList $ \y -> do+-- yield y 1+-- yield y 2+-- yield y 100+-- pure length+-- 3+-- @+withYieldToList ::+ -- | Stream computation+ (forall e. Stream a e -> Eff (e :& es) ([a] -> r)) ->+ -- | Result+ Eff es r+withYieldToList f = do+ (l, g) <- yieldToList f+ pure (g l)+ -- | This is more efficient than 'yieldToList' because it gathers the -- elements into a stack in reverse order. @yieldToList@ then reverses -- that stack.
src/Bluefin/Internal/Examples.hs view
@@ -61,6 +61,13 @@ yield y 2 yield y 100 +withYieldToListExample :: Int+withYieldToListExample = runPureEff $ withYieldToList $ \y -> do+ yield y 1+ yield y 2+ yield y 100+ pure length+ forEachExample :: ([Int], ()) forEachExample = runPureEff $ yieldToList $ \y -> do forEach (inFoldable [0 .. 4]) $ \i -> do