
On 21 June 2017 at 03:19, Dennis Raddle
Looking at my application needs, such as access to pseudorandom numbers and threads, does this suggest a particular course of action?
For randomness, probably mwc-random, carrying the seed around in a StateT with IO on the bottom of the stack. For multi-threaded: parallelism or concurrency? Simon Marlow's Parallel and Concurrent Programming in Haskell is an excellent book on the topic: http://shop.oreilly.com/product/0636920026365.do
D
On Tue, Jun 20, 2017 at 1:40 AM, Ivan Lazar Miljenovic
wrote: There are two general schools of thought as to how to deal with exceptions:
* ExceptT/MonadError from transformers/mtl:
http://www.mega-nerd.com/erikd/Blog/CodeHacking/Haskell/what_do_you_mean.htm...
* The exceptions package (which is a lifted variant of Control.Exception in base): https://www.fpcomplete.com/blog/2016/11/exceptions-best-practices-haskell
On 20 June 2017 at 15:53, Dennis Raddle
wrote: Just want to bump this request as I have not gotten a reply.
On Fri, Jun 16, 2017 at 1:45 PM, Dennis Raddle
wrote: I am wondering what exception/error and random classes I should use for my application.
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. D
_______________________________________________ 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.
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com