add a dummy implementation of System.Timeout.timeout for nhc98
authorMalcolm.Wallace@cs.york.ac.uk <unknown>
Mon, 28 May 2007 11:03:09 +0000 (11:03 +0000)
committerMalcolm.Wallace@cs.york.ac.uk <unknown>
Mon, 28 May 2007 11:03:09 +0000 (11:03 +0000)
Makefile.nhc98
System/Timeout.hs

index 17947b5..732b353 100644 (file)
@@ -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 \
index 48f0ddc..c7e4ee2 100644 (file)
 
 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