[Haskell-cafe] Mutable data structures and asynchronous exceptions

Gregory Collins greg at gregorycollins.net
Sat Sep 30 05:54:03 UTC 2017


Hi Stanislav,

On Thu, Sep 28, 2017 at 7:00 AM, Станислав Черничкин <schernichkin at gmail.com
> wrote:

>
> This lead to conflicting requirements:
> - One should not care about asynchronous exceptions inside ST (it is not
> possible to catch exception in ST, hence not possible to use something in
> invalid state). More over, it is not even possible to do write
> “exception-safe” code, because masking functions not available.
>

You can't fork in ST :). So there's no need to mask there - values created
during the execution will be discarded and cannot be reused unless you use
unsafe*

2. Documentation. Should library authors explicitly mention async
> exceptions safety? For example https://hackage.haskell.org/
> package/hashtables – is it async exceptions safe when used in IO?
>

The hashtables library is not safe for concurrent modification, you need
locking for that. No masking is done right now either, which is probably a
mistake. We should mask when we stToIO.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170930/01ea2683/attachment.html>


More information about the Haskell-Cafe mailing list