packages feed

churros 0.1.0.2 → 0.1.0.3

raw patch · 3 files changed

+30/−3 lines, 3 filesPVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

API changes (from Hackage documentation)

+ Control.Churro.Prelude: sources :: Transport t => [Source t o] -> Source t o

Files

CHANGELOG.md view
@@ -1,5 +1,18 @@ # Revision history for churros -## 0.1.0.0 -- YYYY-mm-dd+## 0.1.0.3 -- 2020-10-12++* Fixed broken changelog.+* Added `sources` combinator.++## 0.1.0.2 -- 2020-10-12++* Added new prelude functions and updated to export main library.++## 0.1.0.1 -- 2020-10-12++* Updated documentation.++## 0.1.0.0 -- 2020-10-12  * First version. Released on an unsuspecting world.
churros.cabal view
@@ -1,6 +1,6 @@ cabal-version:       2.2 name:                churros-version:             0.1.0.2+version:             0.1.0.3 license-file:        LICENSE author:              Lyndon Maydwell maintainer:          lyndon@sordina.net
src/Control/Churro/Prelude.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE BlockArguments #-}@@ -13,7 +14,7 @@ import           Control.Arrow            (arr) import           Control.Category         (id, (.), (>>>)) import           Control.Concurrent       (threadDelay)-import           Control.Concurrent.Async (Async, wait)+import           Control.Concurrent.Async (waitAny, Async, wait) import           Control.Exception        (Exception, SomeException, try) import           Control.Monad            (replicateM_, when) import           Data.Foldable            (for_)@@ -111,6 +112,19 @@     buildChurro \_i o -> do         cb (yeet o . Just)         yeet o Nothing++-- | Combine a list of sources into a single source.+-- +-- Sends individual items downstream without attempting to combine them.+-- +-- >>> runWaitChan $ sources [pure 1, pure 1] >>> sinkPrint+-- 1+-- 1+sources :: Transport t => [Source t o] -> Source t o+sources ss = sourceIO \cb -> do+    asyncs <- mapM (\s -> run $ s >>> sinkIO cb) ss+    (a, _) <- waitAny asyncs+    wait a  -- ** Sinks