{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleContexts #-}
module Main where
import Control.Monad.State.Strict
import qualified Data.Time.Clock as Clock
import Control.Exception
run1 :: (Int -> (Num Int => State Int Bool)) -> Int -> IO ()
run1 f state = do
t1 <- Clock.getCurrentTime
evaluate $ runState (f 1) state
t2 <- Clock.getCurrentTime
print $ Clock.diffUTCTime t2 t1
run1 f state
run2 :: Num s => (Int -> State s Bool) -> s -> IO ()
run2 f state = do
t1 <- Clock.getCurrentTime
evaluate $ runState (f 1) state
t2 <- Clock.getCurrentTime
print $ Clock.diffUTCTime t2 t1
run2 f state
main :: IO ()
main = run1 (const $ return False) 1
--main = run2 (const $ return False) 1