Idris2/libs/base/Debug/Trace.idr

19 lines
346 B
Idris
Raw Normal View History

2020-05-18 15:59:07 +03:00
module Debug.Trace
import Prelude
import PrimIO
%default total
2020-05-18 15:59:07 +03:00
export
trace : (msg : String) -> (result : a) -> a
trace x val = unsafePerformIO (do putStrLn x; pure val)
export %inline
traceValBy : (msgF : a -> String) -> (result : a) -> a
traceValBy f v = trace (f v) v
export %inline
traceVal : Show a => a -> a
traceVal = traceValBy show