[Haskell-cafe] Track Exceptions
Tillmann Rendel
rendel at informatik.uni-marburg.de
Thu Mar 13 22:49:38 UTC 2014
Hi,
Ruud Koot wrote:
> 1) Consider the higher-order function 'map'. With tracked exceptions
> you would probably want to give it a type such as:
>
> map :: forall a b e. (a -> b throws e) -> [a] -> [b] throws e
To account for exceptions hidden in thunks, I would have expected
something more like this:
map :: forall a b e1 e2 e3 e4 .
(forall e . a throws e -> b throws e1 e) throws e2 ->
[a throws e3] throws e4 ->
[b throws (e1 e3, e2)] throws e4
map f [] = []
map f (x :: xs) = f x :: map f xs
Note that e1 is of kind "exception -> exception". If it is a constant
function, f does not force its argument; if it is the identity function,
f forces its argument but cannot throw any other exceptions; etc.
Interestingly, exception tracking seems to feel like strictness analysis.
Tillmann
More information about the Haskell-Cafe
mailing list