[Haskell] modern language design, stone age tools

Alastair Reid alastair at reid-hoffmann.net
Thu Jun 24 07:59:36 EDT 2004


> This is due to the nature of exceptions in Haskell.  Evaluating the
> expression (do a <- getLine; hPutStrLn ...) does not do any IO, and it
> doesn't raise any exceptions, so the mapException doesn't get to
> annotate any exceptions.

Urgh, so the automatic annotation I suggested suffers from two problems:

1) It gives the call by name call stack when we usually want the call by value 
call stack.

2) It would have to be done in a type-sensitive way.  Functions which return 
an IO result need to be annotated with mapExceptionIO while others need to be 
annotated with mapException.  (For that matter, anyone defining 'sum = foldr 
(+) 0' will want a 3rd variant of mapException for use with CAFs whose value 
is a 1,2,3,etc-argument function.)  Hmmmm, I'll bet Oleg can come up with a 
cunning pattern of type classes for this purpose :-).

--
Alastair Reid


More information about the Haskell mailing list