2 import "JavaBuiltin" as Java
4 importJava "java.lang.System" where
5 nanoTime :: () -> <Proc> Long
8 Executes the expression and returns the result
9 together with execution time in seconds.
11 time :: (<e> a) -> <Proc,e> (a,Double)
13 beginTime = nanoTime ()
16 (result, Java.l2d (endTime-beginTime) * 1e-9)
18 reportTime :: (<e> a) -> <e> a
19 reportTime f = runProc do
20 beginTime = nanoTime ()
23 time = Java.l2d (endTime-beginTime) * 1e-9
24 print "time \(time) s"
27 reportTimeM :: String -> (<e> a) -> <e> a
28 reportTimeM task f = runProc do
29 beginTime = nanoTime ()
32 time = Java.l2d (endTime-beginTime) * 1e-9
33 print "\(task): \(time) s"
37 Prints the given text and returns
40 trace :: String -> a -> a
41 trace text value = runProc do
46 Prints the given value and returns
49 traceShow :: Show a => a -> b -> b
50 traceShow p v = trace (show p) v