[Haskell-cafe] ContT and MonadSafe
Compl Yue
compl.yue at gmail.com
Tue Nov 16 14:57:04 UTC 2021
I would suggest that continuations don't even belong to the "structured programming" camp, while exceptions are well structured in this regard, so I doubt they can mix well.
But continuation is powerful enough to implement exception throwing/catching, so maybe it's just the existing synchronous, `IO` based exceptions don't cooperate well, you may be able to get well with your own implementation of try/catch/bracket with continuations there.
> On 2021-11-16, at 22:45, PICCA Frederic-Emmanuel <frederic-emmanuel.picca at synchrotron-soleil.fr> wrote:
>
> I end up with this but I do not know if this is the best solution.
>
> withHdf5PathP loc (H5Or l r) = ContT $ \cont -> (runContT (withHdf5PathP loc l) cont)
> `catchAll`
> const (runContT (withHdf5PathP loc r) cont)
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
More information about the Haskell-Cafe
mailing list