From 48b5ddb3fc2d52d172230da3916e1b06bf36eafa Mon Sep 17 00:00:00 2001 From: "Malcolm.Wallace@cs.york.ac.uk" Date: Mon, 28 May 2007 11:03:09 +0000 Subject: [PATCH] add a dummy implementation of System.Timeout.timeout for nhc98 --- Makefile.nhc98 | 2 +- System/Timeout.hs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile.nhc98 b/Makefile.nhc98 index 17947b5..732b353 100644 --- a/Makefile.nhc98 +++ b/Makefile.nhc98 @@ -29,7 +29,7 @@ SRCS = \ System/Environment.hs System/Exit.hs \ System/Mem.hs System/Info.hs \ System/Console/GetOpt.hs \ - System/CPUTime.hsc \ + System/CPUTime.hsc System/Timeout.hs \ Foreign/Ptr.hs Foreign/StablePtr.hs Foreign/Storable.hs \ Foreign/ForeignPtr.hs Foreign/C/Types.hs \ Foreign/Marshal/Alloc.hs Foreign/Marshal/Array.hs \ 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 -- 1.7.10.4