Hi
I have made on file called time.hs
which contains a single function for measuring the time another function takes to complete.
Is there a way to import this time.hs
file into the other haskell scripts I have made similar to import?
I sort of want:
module Main where
import C:\Haskell\time.hs
main = do
putStrLn "Starting..."
time $ print answer
putStrLn "Done."
Where time is defined in the time.hs file by:
module time where
Import <necessary modules>
time a = do
start <- getCPUTime
v <- a
end <- getCPUTime
let diff = (fromIntegral (end - start)) / (10^12)
printf "Computation time: %0.3f sec\n" (diff :: Double)
return v
But I don't know how to import or load a seperate .hs file, is this possible or must I compile the time.hs file into a module?