There is the package hint, which embeds the calls to GHC API.<br><br>Quite easy to use:<br>Let&#39;s say your configuration file (cfg/Script.hs) contains a function &quot;script&quot; that you want to get:<br><br>type ScriptFun = IO ()<br>
<br>loadScript :: IO ScriptFun<br>loadScript = do<br>  liftM (either (error . show) id) $ runInterpreter $ do<br>    path &lt;- get searchPath<br>    set [searchPath := (&quot;./cfg&quot;:path)]<br>    loadModules [&quot;Script&quot;]<br>
    setTopLevelModules [&quot;Script&quot;]<br>    exports &lt;- getModuleExports &quot;Script&quot;<br>    if Fun &quot;script&quot; `elem` exports<br>      then <b>interpret &quot;script&quot; (as :: ScriptFun)</b><br>      else error &quot;script function not found&quot;<br>
<br><br>There is just the line I put in bold that bothers me. Can&#39;t we get the action &quot;script&quot; more easily than by re-interpreting some code?<br><br><div class="gmail_quote">2010/5/8 Brandon S. Allbery KF8NH <span dir="ltr">&lt;<a href="mailto:allbery@ece.cmu.edu">allbery@ece.cmu.edu</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im">On May 4, 2010, at 01:52 , Maciej Piechotka wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
After change of file you have to wait a long time as it compiles and<br>
links with yi. On my system (1 GB of RAM taken by system + 1 GB &#39;free&#39; +<br>
2 GB swaps, x86-64) it could in some situations it caused OOM. I&#39;d<br>
prefer if the code was interpreted by ghci instead of compiled by GHC in<br>
this case (it should be as fast as most of the code was compiled<br>
anyway).<br>
</blockquote>
<br>
<br></div>
On the one hand, this is doable with the GHC API.  On the other, that more or less means your program contains what amounts to a full copy of GHC.<br><font color="#888888">
<br>
-- <br>
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] <a href="mailto:allbery@kf8nh.com" target="_blank">allbery@kf8nh.com</a><br>
system administrator [openafs,heimdal,too many hats] <a href="mailto:allbery@ece.cmu.edu" target="_blank">allbery@ece.cmu.edu</a><br>
electrical and computer engineering, carnegie mellon university    KF8NH<br>
<br>
<br>
</font><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>