classy-prelude 0.12.6 → 0.12.7
raw patch · 4 files changed
+25/−9 lines, 4 filesdep +transformers-basePVP ok
version bump matches the API change (PVP)
Dependencies added: transformers-base
API changes (from Hackage documentation)
+ ClassyPrelude: yieldThread :: MonadBase IO m => m ()
Files
- ChangeLog.md +4/−0
- ClassyPrelude.hs +11/−0
- classy-prelude.cabal +2/−1
- test/main.hs +8/−8
ChangeLog.md view
@@ -1,3 +1,7 @@+## 0.12.7++* Concurrency: reexport `Control.Concurrent.Lifted` and provide `yieldThread`+ ## 0.12.6 * Regeneralize intercalate [#119](https://github.com/snoyberg/classy-prelude/pull/119)
ClassyPrelude.hs view
@@ -75,6 +75,9 @@ , stdin , stdout , stderr+ -- * Concurrency+ , module Control.Concurrent.Lifted+ , yieldThread -- * Non-standard -- ** List-like classes , map@@ -175,6 +178,8 @@ import Control.Exception (assert) import Control.Exception.Enclosed import Control.Monad (when, unless, void, liftM, ap, forever, join, replicateM_, guard, MonadPlus (..), (=<<), (>=>), (<=<), liftM2, liftM3, liftM4, liftM5)+import Control.Concurrent.Lifted hiding (yield)+import qualified Control.Concurrent.Lifted as Conc (yield) import Control.Concurrent.MVar.Lifted import Control.Concurrent.Chan.Lifted import Control.Concurrent.STM hiding (atomically, always, alwaysSucceeds, retry, orElse, check)@@ -186,6 +191,7 @@ import Data.Foldable (Foldable) import Data.IOData (IOData (..)) import Control.Monad.Catch (MonadThrow (throwM), MonadCatch, MonadMask)+import Control.Monad.Base import Data.Vector.Instances () import CorePrelude hiding (print, undefined, (<>), catMaybes, first, second)@@ -509,6 +515,11 @@ -- Since 0.5.9 traceShowM :: (Show a, Monad m) => a -> m () traceShowM = traceM . show++-- | Originally 'Conc.yield'.+yieldThread :: MonadBase IO m => m ()+yieldThread = Conc.yield+{-# INLINE yieldThread #-} fpToString :: FilePath -> String fpToString = id
classy-prelude.cabal view
@@ -1,5 +1,5 @@ name: classy-prelude-version: 0.12.6+version: 0.12.7 synopsis: A typeclass-based Prelude. description: Modern best practices without name collisions. No partial functions are exposed, but modern data structures are, without requiring import lists. Qualified modules also are not needed: instead operations are based on type-classes from the mono-traversable package. @@ -40,6 +40,7 @@ , bifunctors , mutable-containers >= 0.3 && < 0.4 , dlist >= 0.7+ , transformers-base ghc-options: -Wall -fno-warn-orphans test-suite test
test/main.hs view
@@ -378,22 +378,22 @@ failed <- newIORef 0 tid <- forkIO $ do catchAny- (threadDelay 20000)+ (Control.Concurrent.threadDelay 20000) (const $ writeIORef failed 1) writeIORef failed 2- threadDelay 10000- throwTo tid DummyException- threadDelay 50000+ Control.Concurrent.threadDelay 10000+ Control.Concurrent.throwTo tid DummyException+ Control.Concurrent.threadDelay 50000 didFail <- readIORef failed liftIO $ didFail `shouldBe` (0 :: Int) it "tryAny" $ do failed <- newIORef False tid <- forkIO $ do- _ <- tryAny $ threadDelay 20000+ _ <- tryAny $ Control.Concurrent.threadDelay 20000 writeIORef failed True- threadDelay 10000- throwTo tid DummyException- threadDelay 50000+ Control.Concurrent.threadDelay 10000+ Control.Concurrent.throwTo tid DummyException+ Control.Concurrent.threadDelay 50000 didFail <- readIORef failed liftIO $ didFail `shouldBe` False it "tryAnyDeep" $ do