[Haskell] modern language design, stone age tools

John Meacham john at repetae.net
Wed Jun 23 18:29:45 EDT 2004


On Wed, Jun 23, 2004 at 09:43:46PM +0100, Alastair Reid wrote:
> 2) If you don't want to put errors in the type system, you could instead use
>    exceptions something along the lines of:
> 
>       myFunc 0 x = mapException 
>                      (\ err -> show err ++ "when invoked by myFunc 0")
>                      (head x)
> 
>    [Not quite type correct but hopefully clear enough.  The idea is to combine
>     the exception value returned with some extra information about the context
>     with the idea that whoever called myFunc might add extra information.
>     Ideally, the Exception type would be recursive so we could build chains of
>     exceptions without having to use Show.]

Yes, I do something very similar to this in ginsu, what would be really
really nice is if Exception were extended with

AnnotatedException String Exception

and the various routines like isIOError were modified to 'look through'
these annotations.

adding stack traces just where you think it might be useful becomes
quite easy then. 
        John

-- 
John Meacham - ⑆repetae.net⑆john⑈ 


More information about the Haskell mailing list