packages feed

unbounded-delays 0.1.0.10 → 0.1.1.0

raw patch · 3 files changed

+24/−30 lines, 3 filessetup-changedPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Concurrent.Timeout: data Timeout
+ Control.Concurrent.Timeout: timeoutWithPred :: Integer -> ((Timeout -> Bool) -> IO α) -> IO (Maybe α)

Files

Control/Concurrent/Timeout.hs view
@@ -15,7 +15,7 @@ -- Wait arbitrarily long for an IO computation to finish. ------------------------------------------------------------------------------- -module Control.Concurrent.Timeout ( timeout ) where+module Control.Concurrent.Timeout ( timeout, Timeout, timeoutWithPred ) where   -------------------------------------------------------------------------------@@ -26,8 +26,9 @@ import Control.Concurrent       ( forkIOWithUnmask, myThreadId, throwTo, killThread ) import Control.Exception        ( Exception, bracket, handleJust ) import Control.Monad            ( return, (>>), fmap )-import Data.Bool                ( otherwise )+import Data.Bool                ( Bool(False), otherwise ) import Data.Eq                  ( Eq, (==) )+import Data.Function            ( (.), const) import Data.Maybe               ( Maybe(Nothing, Just) ) import Data.Ord                 ( (<) ) import Data.Typeable            ( Typeable )@@ -41,7 +42,7 @@ import Control.Monad            ( (>>=), fail ) #endif -#ifdef __HADDOCK__+#ifdef __HADDOCK_VERSION__ import Data.Int                 ( Int ) import System.IO                ( hGetBuf, hPutBuf, hWaitForInput ) import qualified System.Timeout ( timeout )@@ -71,13 +72,17 @@  {-| Like @System.Timeout.'System.Timeout.timeout'@, but not bounded by an 'Int'.-+(..) Wrap an 'IO' computation to time out and return 'Nothing' in case no result is available within @n@ microseconds (@1\/10^6@ seconds). In case a result is available before the timeout expires, 'Just' @a@ is returned. A negative timeout interval means \"wait indefinitely\". -The design of this combinator was guided by the objective that @timeout n f@+If the computation has not terminated after @n@ microseconds, it is interrupted+by an asynchronous exception. The function passed to @f@ can be used to detect+whether it was interrupted by this timeout or some other exception.++The design of this combinator was guided by the objective that @timeout n (const f)@ should behave exactly the same as @f@ as long as @f@ doesn't time out. This means that @f@ has the same 'myThreadId' it would have without the timeout wrapper. Any exceptions @f@ might throw cancel the timeout and propagate further@@ -99,9 +104,9 @@ @select(2)@ to perform asynchronous I\/O, so it is possible to interrupt standard socket I\/O or file I\/O using this combinator. -}-timeout :: Integer -> IO α -> IO (Maybe α)-timeout n f-    | n < 0     = fmap Just f+timeoutWithPred :: Integer -> ((Timeout -> Bool) -> IO α) -> IO (Maybe α)+timeoutWithPred n f+    | n < 0     = fmap Just (f (const False))     | n == 0    = return Nothing     | otherwise = do         pid <- myThreadId@@ -110,5 +115,11 @@                    (\_ -> return Nothing)                    (bracket (forkIOWithUnmask (\unmask -> unmask (delay n >> throwTo pid ex)))                             (killThread)-                            (\_ -> fmap Just f)+                            (\_ -> fmap Just (f (==ex)))                    )++{-|+Like 'timeoutWithPred', but does not expose the 'Timeout' exception to the called action.+-}+timeout :: Integer -> IO α -> IO (Maybe α)+timeout n = timeoutWithPred n . const
Setup.hs view
@@ -1,19 +1,2 @@-#! /usr/bin/env runhaskell--import Distribution.Simple                ( defaultMainWithHooks-                                          , simpleUserHooks-                                          , UserHooks(haddockHook)-                                          )-import Distribution.Simple.Setup          ( HaddockFlags )-import Distribution.Simple.Program        ( userSpecifyArgs )-import Distribution.Simple.LocalBuildInfo ( LocalBuildInfo(withPrograms) )-import Distribution.PackageDescription    ( PackageDescription )--main :: IO ()-main = defaultMainWithHooks $ simpleUserHooks { haddockHook = haddockHook' }---- Define __HADDOCK__ for CPP when running haddock.-haddockHook' :: PackageDescription -> LocalBuildInfo -> UserHooks -> HaddockFlags -> IO ()-haddockHook' pkg lbi = haddockHook simpleUserHooks pkg $ lbi { withPrograms = p }-    where-      p = userSpecifyArgs "haddock" ["--optghc=-D__HADDOCK__"] (withPrograms lbi)+import Distribution.Simple+main = defaultMain
unbounded-delays.cabal view
@@ -1,7 +1,7 @@ name:          unbounded-delays-version:       0.1.0.10+version:       0.1.1.0 cabal-version: >= 1.6-build-type:    Custom+build-type:    Simple author:        Bas van Dijk <v.dijk.bas@gmail.com>                Roel van Dijk <vandijk.roel@gmail.com> maintainer:    Bas van Dijk <v.dijk.bas@gmail.com>