0
我想使用getRealTime功能從Test.Hspec.Formatters返回一個Double值(或IO雙 - 東西,我可以打印到屏幕爲例):FormatM - > IO雙
這裏的getRealTime定義:
getRealTime :: FormatM Double
getRealTime = do
t1 <- liftIO getPOSIXTime
t0 <- gets startTime
return (realToFrac $ t1 - t0)
newtype FormatM a = FormatM (StateT (IORef FormatterState) IO a)
deriving (Functor, Applicative, Monad, MonadIO)
我要尋找一個實現此的代碼示例:
getTime :: FormatM Double -> IO Double
感謝