mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-25 12:42:02 +03:00
[ base ] Add a trace
variant easily embeddable to point-free expr
This commit is contained in:
parent
b4662a8537
commit
71c68d8dcf
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user