Skip to content

Commit

Permalink
Add concurrently_ to match non-lifted async library (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ch3pjw authored and Mitsutoshi Aoe committed Jun 23, 2017
1 parent 38e7594 commit 73f66d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lifted-async.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ library
Control.Concurrent.Async.Lifted.Safe
build-depends:
base >= 4.5 && < 4.11
, async >= 2.0.1 && < 2.2
, async >= 2.1.1 && < 2.2
, lifted-base >= 0.2 && < 0.3
, transformers-base >= 0.4 && < 0.5
if flag(monad-control-1)
Expand Down
6 changes: 5 additions & 1 deletion src/Control/Concurrent/Async/Lifted.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ module Control.Concurrent.Async.Lifted
, link, link2

-- * Convenient utilities
, race, race_, concurrently
, race, race_, concurrently, concurrently_
, mapConcurrently, mapConcurrently_
, forConcurrently, forConcurrently_
, Concurrently(..)
Expand Down Expand Up @@ -362,6 +362,10 @@ concurrently left right =
waitBoth a b
{-# INLINABLE concurrently #-}

concurrently_ :: MonadBaseControl IO m => m a -> m b -> m ()
concurrently_ left right = void $ concurrently left right
{-# INLINABLE concurrently_ #-}

-- | Generalized version of 'A.mapConcurrently'.
mapConcurrently
:: (Traversable t, MonadBaseControl IO m)
Expand Down
7 changes: 6 additions & 1 deletion src/Control/Concurrent/Async/Lifted/Safe.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ module Control.Concurrent.Async.Lifted.Safe
, Unsafe.link, Unsafe.link2

-- * Convenient utilities
, race, race_, concurrently
, race, race_, concurrently, concurrently_
, mapConcurrently, mapConcurrently_
, forConcurrently, forConcurrently_
, Concurrently(..)
Expand Down Expand Up @@ -327,6 +327,11 @@ concurrently
=> m a -> m b -> m (a, b)
concurrently = liftBaseOp2_ A.concurrently

concurrently_
:: forall m a b. (MonadBaseControl IO m, Forall (Pure m))
=> m a -> m b -> m ()
concurrently_ = liftBaseOp2_ A.concurrently_

-- | Similar to 'A.liftBaseOp_' but takes a binary function
-- and leverages @'StM' m a ~ a@.
liftBaseOp2_
Expand Down

0 comments on commit 73f66d1

Please sign in to comment.