[Haskell-cafe] implicit call stacks and calling function

Eric Seidel eric at seidel.io
Tue Mar 8 02:45:19 UTC 2016


On Mon, Mar 7, 2016, at 15:36, Evan Laforge wrote:
> On Mon, Mar 7, 2016 at 11:46 AM, Eric Seidel <eric at seidel.io> wrote:
> > The reason we provide the name of the callee is that the standard format
> > for a stack trace is callee+pos :)
> 
> I guess it depends how you look at it.  I'm used to caller + pos, e.g. in
> Java:
> 
> java.lang.RuntimeException: blah blah
> at com...Caller.caller(Caller.java:494)
> at ...
> 
> Or python:
> 
> Traceback (most recent call last):
>   File "t.py", line 2, in caller
>     def caller(): callee()
>   File "t.py", line 1, in callee
>     def callee(): 1/0
> ZeroDivisionError: integer division or modulo by zero
> 
> The haskell version (reversed to match python) would be like:
> 
> File "Caller.hs", line 6, in callee
>     caller = callee 10
> File "Caller.hs", line 9, in ?stack
>     callee _n = mapM_ print (Stack.getCallStack ?stack)
> 
> To me this seems off by one, line 6 is in 'caller', not 'callee'.

Huh, you're quite right.. I remember checking python's formatting when I
originally implemented the feature but I must have misread the stack..


More information about the Haskell-Cafe mailing list