X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=System%2FTimeout.hs;fp=System%2FTimeout.hs;h=c7e4ee21930158114ac58f1dfc801376471b8902;hb=48b5ddb3fc2d52d172230da3916e1b06bf36eafa;hp=48f0ddcf29c74e6878fb7c6c113a35638f53d173;hpb=f55c41f1e240e4182386be7535b49ecadde23548;p=ghc-base.git diff --git a/System/Timeout.hs b/System/Timeout.hs index 48f0ddc..c7e4ee2 100644 --- a/System/Timeout.hs +++ b/System/Timeout.hs @@ -15,6 +15,11 @@ module System.Timeout ( timeout ) where +#if __NHC__ +timeout :: Int -> IO a -> IO (Maybe a) +timeout n f = fmap Just f +#else + import Prelude (IO, Ord((<)), Eq((==)), Int, (.), otherwise, fmap) import Data.Maybe (Maybe(..)) import Control.Monad (Monad(..), guard) @@ -70,3 +75,4 @@ timeout n f (bracket (forkIO (threadDelay n >> throwDynTo pid ex)) (killThread) (\_ -> fmap Just f)) +#endif