debugging - How to print with line number and stack trace in Haskell? -
i java appended print statements , had stack trace...
how can print line numbers log in java
public static int getlinenumber() { // second row of stack trace had caller file name, etc. return thread.currentthread().getstacktrace()[2]; }
how do haskell?
i think found solution:
debug.trace: functions tracing , monitoring execution.
tracestack :: string -> -> source
like trace, additionally prints call stack if 1 available.
in current ghc implementation, call stack availble if program compiled -prof; otherwise tracestack behaves trace. entries in call stack correspond scc annotations, idea use -fprof-auto or -fprof-auto-calls add scc annotations automatically.
since: 4.5.0.0
^ https://hackage.haskell.org/package/base-4.8.2.0/docs/debug-trace.html
Comments
Post a Comment