Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've found a beautiful <a href="http://hackage.haskell.org/package/monad-parallel" rel="nofollow">"monad-parallel"</a> library intended for very similar purposes, and an even more powerful fork of it - <a href="http://hackage.haskell.org/package/classy-parallel" rel="nofollow">"classy-parallel"</a>.</p> <p>For a monad to be usable in a parallelizable manner it needs to have an instance of a <a href="http://hackage.haskell.org/packages/archive/classy-parallel/0.1.0.0/doc/html/Control-Monad-Parallel.html#t%3aParallel" rel="nofollow"><code>Parallel</code></a> typeclass. And the "classy-parallel" library already provides instances for the most important types for such purposes: <code>ResourceT IO</code> and <code>ReaderT</code>.</p> <p>Assuming the presence of appropriate instances the code in question can be transformed to following:</p> <pre><code>import qualified Control.Monad.Parallel as Parallel main = runConnection connectionSettings $ Parallel.sequence [action1, action2, action3] </code></pre> <p>For simply forking in <code>ResourceT</code> the <a href="http://hackage.haskell.org/packages/archive/resourcet/0.3.0/doc/html/Control-Monad-Trans-Resource.html#v%3aresourceForkIO" rel="nofollow"><code>resourceForkIO</code></a> can be useful. There's also a <a href="http://hackage.haskell.org/package/monad-fork-0.1" rel="nofollow">"monad-fork"</a> library which provides a neat and simple generalization over forking on top of <code>forkIO</code> and <code>resourceForkIO</code>.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload