[Haskell-cafe] Debugging partial functions by the rules

Matthias Fischmann fis at wiwi.hu-berlin.de
Wed Nov 15 01:57:59 EST 2006


On Wed, Nov 15, 2006 at 03:54:31PM +1100, Donald Bruce Stewart wrote:
> To: glasgow-haskell-users at haskell.org
> Cc: haskell-cafe at haskell.org
> From: Donald Bruce Stewart <dons at cse.unsw.edu.au>
> Date: Wed, 15 Nov 2006 15:54:31 +1100
> Subject: [Haskell-cafe] Debugging partial functions by the rules
> 
> So all this talk of locating head [] and fromJust failures got me
> thinking:
> 
>     Couldn't we just use rewrite rules to rewrite *transparently*
>     all uses of fromJust to safeFromJust, tagging the call site
>     with a location?

The problem with tagging the call site is that there has to be an
explicit location somewhere in the code that is maximally meaningful
for the user.  I don't think that's the whole story.

I have always been wondering why error shouldn't always return a call
stack from the occurrance of fromJust up to the function I typed into
ghci (or up to main, for that matter).

I guess this is because the call tree is rewritten extensively before
being evaluated, and the output wouldn't be so easy to match to the
source code?  But shouldn't the mapping of source tree to executable
tree be bijective, at least in theory?

How hard would it be to hack call stack output into ghc?


-matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20061115/d8996b6c/attachment.bin


More information about the Haskell-Cafe mailing list