title: Distributing Haskell on a cluster
body: <p>I have a piece of code that process files,</p>
  
  <pre><code>processFiles ::  [FilePath] -&gt; (FilePath -&gt; IO ()) -&gt; IO ()
  </code></pre>
  
  <p>This function spawns an async process that execute an IO action. This IO action must be submitted to a cluster through a job scheduling system (e.g Slurm). </p>
  
  <p>Because I must use the job scheduling system, it's not possible to use cloudHaskell to distribute the closure. Instead the program writes a new <em>Main.hs</em> containing the desired computations, that is copy to the cluster node together with all the modules that main depends on and then it is executed remotely with "runhaskell Main.hs [opts]". Then the async process should ask periodically to the job scheduling system (using <em>threadDelay</em>) if the job is done. </p>
  
  <p>Is there a way to avoid creating a new Main? Can I serialize the IO action and execute it somehow in the node?</p>