나는 time.hs
이라는 파일을 만들었습니다. 다른 기능의 실행 시간을 측정하는 단일 기능을 포함합니다.하스켈에서 .hs 파일을 가져 오는 방법
time.hs
파일을 다른 Haskell 스크립트로 가져 오는 방법이 있습니까? 내가 가져 오거나로드하는 방법을 모른다
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
: 시간과 'time.hs'에 정의되어있다
module Main where
import C:\Haskell\time.hs
main = do
putStrLn "Starting..."
time $ print answer
putStrLn "Done."
:
내가 좋아하는 뭔가를 원하는 별도의 .hs
파일 가져 오기 전에 time.hs
파일을 모듈로 컴파일해야합니까?
이것은 유형이고, 수입 '시간'은 정확합니다. – mrsteve