Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print call stack of recursive loop

Tags:

haskell

ghci

Is there a generic function (printCallStack) that will print the call stack of a recursive loop.

For example,

printCallStack(length ([7, 1 'quot' 0])) 

prints call stack :

enter image description here

like image 447
blue-sky Avatar asked Jul 04 '26 08:07

blue-sky


1 Answers

It seems that you are looking for something like Hat, which is a source level tracer for haskell, and possibly specifically for hat-stack, which is the stack tracer component.

You can alternatively use the debugger/tracer built into ghci. Not as nice as hat, but doesn't require to recompile your code and it's readily available. In case you wonder, it's the :trace command in ghci.

like image 114
fgv Avatar answered Jul 05 '26 23:07

fgv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!