Skip to content

Instantly share code, notes, and snippets.

@arianvp
Created September 22, 2012 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arianvp/3767979 to your computer and use it in GitHub Desktop.
Save arianvp/3767979 to your computer and use it in GitHub Desktop.
7 main :: IO()
6 main = do
5
4 forM [1000000..5000000] $ \x -> do
3 a <- getCPUTime
2 return $! fib x
1 b <- getCPUTime
0 putStrLn $ show ((b-a) `div` 10^9)
===============================================================
Press ENTER or type command to continue
[1 of 1] Compiling Main ( higher-order-functions.hs, higher-order-functions.o )
higher-order-functions.hs:59:5:
Couldn't match expected type `()' with actual type `[()]'
Expected type: IO ()
Actual type: IO [()]
In a stmt of a 'do' block:
forM [1000000 .. 5000000]
$ \ x
-> do { a <- getCPUTime;
return $! fib x;
.... }
In the expression:
do { forM [1000000 .. 5000000] $ \ x -> do { ... } }
shell returned 1
Press ENTER or type command to continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment