[ base ] Add a trace variant easily embeddable to point-free expr

This commit is contained in:
Denis Buzdalov 2022-04-13 19:11:17 +03:00 committed by G. Allais
parent b4662a8537
commit 71c68d8dcf

View File

@ -8,3 +8,11 @@ import PrimIO
export export
trace : (msg : String) -> (result : a) -> a trace : (msg : String) -> (result : a) -> a
trace x val = unsafePerformIO (do putStrLn x; pure val) 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