Fix incorrect changes to C types in a foreign import for nhc98.
authorMalcolm.Wallace@cs.york.ac.uk <unknown>
Wed, 4 Apr 2007 12:09:54 +0000 (12:09 +0000)
committerMalcolm.Wallace@cs.york.ac.uk <unknown>
Wed, 4 Apr 2007 12:09:54 +0000 (12:09 +0000)
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

index 4e9ba1e..8b648a7 100644 (file)
@@ -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