[Haskell-cafe] exceptions, errors, random
dennis.raddle at gmail.com
Tue Jun 20 05:53:05 UTC 2017
Just want to bump this request as I have not gotten a reply.
On Fri, Jun 16, 2017 at 1:45 PM, Dennis Raddle <dennis.raddle at gmail.com>
> I am wondering what exception/error and random classes I should use for my
> The application will be doing Monte Carlo backtracking search. I want it
> to be multithreaded and run on all four cores on my MacBook.
> I need detailed error messages in order to investigate errors. So I will
> throw errors or exceptions, then catch them in lower functions and annotate
> them with the parameters or computations within the lower function, then
> re-throw until finally the exception pops into the terminal.
> Because it's multi-threaded, at least some parts will needs to be in IO.
> Also, because it's a Monte Carlo algorithm it will need to make
> pseudorandom choices.
> Perhaps I should put everything in the IO monad? This will give me access
> to threads and the standard generator seed. But how about throwing,
> catching/rethrowing exceptions in IO? I have done this in pure code before:
> not sure if it's better to do it that way, in which case I could put some
> kind of state monad to hold the random seed together with an error monad
> and IO at the core of the monad stack.
> Any advice welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe