From a2a70b9bf60672c72b35654105402cf21238b6f4 Mon Sep 17 00:00:00 2001 From: "Malcolm.Wallace@cs.york.ac.uk" Date: Wed, 4 Apr 2007 12:09:54 +0000 Subject: [PATCH] Fix incorrect changes to C types in a foreign import for nhc98. If we use type CTime, it needs to be imported. Also, CTime is not an instance of Integral, so use some other mechanism to convert it. --- System/Random.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/System/Random.hs b/System/Random.hs index 4e9ba1e..8b648a7 100644 --- a/System/Random.hs +++ b/System/Random.hs @@ -70,6 +70,7 @@ import Prelude #ifdef __NHC__ import CPUTime ( getCPUTime ) import Foreign.Ptr ( Ptr, nullPtr ) +import Foreign.C ( CTime, CUInt ) #else import System.CPUTime ( getCPUTime ) import System.Time ( getClockTime, ClockTime(..) ) @@ -86,7 +87,7 @@ import Numeric ( readDec ) data ClockTime = TOD Integer () foreign import ccall "time.h time" readtime :: Ptr CTime -> IO CTime getClockTime :: IO ClockTime -getClockTime = do t <- readtime nullPtr; return (TOD (toInteger t) ()) +getClockTime = do CTime t <- readtime nullPtr; return (TOD (toInteger t) ()) #endif -- | The class 'RandomGen' provides a common interface to random number -- 1.7.10.4