import "Prelude" import "JavaBuiltin" as Java import "Logging" as LOGGER importJava "java.lang.System" where nanoTime :: () -> Long """ Executes the expression and returns the result together with execution time in seconds. """ time :: ( a) -> (a,Double) time f = do beginTime = nanoTime () result = f endTime = nanoTime () (result, Java.l2d (endTime-beginTime) * 1e-9) reportTime :: ( a) -> a reportTime f = runProc do beginTime = nanoTime () result = f endTime = nanoTime () time = Java.l2d (endTime-beginTime) * 1e-9 LOGGER.info "time \(time) s" result reportTimeM :: String -> ( a) -> a reportTimeM task f = runProc do beginTime = nanoTime () result = f endTime = nanoTime () time = Java.l2d (endTime-beginTime) * 1e-9 LOGGER.info "\(task): \(time) s" result """ Prints the given text and returns the second parameter. """ trace :: String -> a -> a trace text value = runProc do printString text value """ Prints the given value and returns the second parameter. """ traceShow :: Show a => a -> b -> b traceShow p v = trace (show p) v