<font face="verdana,sans-serif">I&#39;m not sure that exposing a liftIO for Monad.Par is the best idea. Since all these parallel computations use runPar :: Par a -&gt; a, it advertises that the result is deterministic. I&#39;m not really comfortable with a hidden unsafePerformIO hiding in the background.</font><div>

<font face="verdana,sans-serif"><br></font></div><div><font face="verdana,sans-serif">That said, I don&#39;t see a reason for not including a separate version of runParIO :: ParIO a -&gt; IO a for non-deterministic computations. It seems really useful!</font></div>

<div><font face="verdana,sans-serif"><br></font></div><div><font face="verdana,sans-serif">Regards,</font></div><div><font face="verdana,sans-serif">  - Clark<br></font><br><div class="gmail_quote">On Wed, Oct 3, 2012 at 10:24 AM, Ryan Newton <span dir="ltr">&lt;<a href="mailto:rrnewton@gmail.com" target="_blank">rrnewton@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Several of the monad-par schedulers COULD provide a MonadIO instance and thus &quot;liftIO&quot;, which would make them easy to use for this kind of parallel IO business:</div>

<div><br></div><div>   <a href="http://hackage.haskell.org/packages/archive/monad-par/0.3/doc/html/Control-Monad-Par-Scheds-Direct.html" target="_blank">http://hackage.haskell.org/packages/archive/monad-par/0.3/doc/html/Control-Monad-Par-Scheds-Direct.html</a></div>



<div><br></div><div>And that would be a little more scalable because you wouldn&#39;t get a separate IO thread for each parallel computation.  But, to be safe-haskell compliant, we don&#39;t currently expose IO capabilities. I can add another module that exposes this capability if you are interested...</div>

<span class="HOEnZb"><font color="#888888">

<div><br></div><div>  -Ryan</div><br></font></span><div class="gmail_quote"><div><div class="h5">On Fri, Sep 28, 2012 at 4:48 PM, Alexander Solla <span dir="ltr">&lt;<a href="mailto:alex.solla@gmail.com" target="_blank">alex.solla@gmail.com</a>&gt;</span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><br><br><div class="gmail_quote"><div>On Fri, Sep 28, 2012 at 11:01 AM, Greg Fitzgerald <span dir="ltr">&lt;<a href="mailto:garious@gmail.com" target="_blank">garious@gmail.com</a>&gt;</span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<br>
I also tried Control.Parallel.Strategies [2].  While that route works,<br>
I had to use unsafePerformIO.  Considering that IO is for sequencing<br>
effects and my IO operation doesn&#39;t cause any side-effects (besides<br>
hogging a file handle), is this a proper use of unsafePerformIO?<br></blockquote><div><br></div></div><div>That&#39;s actually a perfectly fine use for unsafePerformIO, since the IO action you are performing is pure and therefore safe (modulo your file handle stuff).</div>




<div><br></div><div>unsafePerformIO is a problem when the IO action being run has side effects and their order of evaluation matters (since unsafePerformIO will cause them to be run in an &quot;unpredictable&quot; order)</div>




<div><br></div><div>One common use for unsafePerformIO is to run a query against an external library.  It has to be done in the IO monad, but it is a &quot;pure&quot; computation insofar as it has no side-effects that matter.  Doing this lets us promote values defined in external libraries to bona fide pure Haskell values.</div>




</div>
<br></div></div><div class="im">_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></div></blockquote></div><br>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>