[Haskell-cafe] Track Exceptions

Jay Sulzberger jays at panix.com
Thu Mar 13 22:01:02 UTC 2014




On Thu, 13 Mar 2014, Ruud Koot <r.koot at uu.nl> wrote:

> In theory, yes, but the situation becomes more complicated for
> higher-order languages such as Haskell than it is for first-order(ish)
> languages such as Java.*
>
> 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

Perhaps one should have a functor going from the category of
badly instrumented source code to the category of instrumented
source code.  Or perhaps to the category of instrumented run time
instances.

oo--JS.


>
> I.e., you need some kind of exception polymorphism, or severely
> restrict the kind of functions you would be allowed to pass to map
> (basically those that are guaranteed to not raise any exceptions).
>
> 2) One of the most commonly encountered run-time exception in Haskell
> is a pattern-match failure. Whether or not these are triggered depends
> not only on the control flow within your program, but also on the data
> flow, making them harder to track.
>
> Some relevant references would be:
>
> - Kevin Glynn, Peter J. Stuckey, Martin Sulzmann & Harald Søndergaard.
> "Exception analysis for non-strict languages". ICFP '02.
> http://dl.acm.org/citation.cfm?id=581488
> - Ruud Koot & Jurriaan Hage. "Type-based exception analysis for
> higher-order non-strict languages with imprecise exception semantics".
> Submitted to ICFP '14.
> http://www.staff.science.uu.nl/~0422819/tbea/icfp14.pdf
>
>
> Ruud
>
>
>
> * Technically, object-oriented languages are also higher-order
> languages and one can find examples where the lack of exception
> polymorphism can cause trouble for Java's tracked exception mechanism.
>
> On Thu, Mar 13, 2014 at 5:15 PM, Silvio Frischknecht
> <silvio.frischi at gmail.com> wrote:
>> Hi everyone,
>>
>> It's always very annoying not knowing what could go wrong (what exceptions
>> might be thrown) when calling a library function. In java doc, for instance,
>> you can usually see what exceptions can be thrown by a specific function. I was
>> wondering if this could be achieved for haskell by tracing "throw" and "catch"
>> calls.
>>
>> Silvio
>> _______________________________________________
>> Haskell-Cafe mailing list
>> Haskell-Cafe at haskell.org
>> http://www.haskell.org/mailman/listinfo/haskell-cafe
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>


More information about the Haskell-Cafe mailing list