<div>&nbsp;</div>
<div>I am writing a Java program with a call to a &nbsp;Haskell module&nbsp; M.hs,</div>
<div>in order to evaluate some expression&nbsp;&nbsp; expr.</div>
<div>&nbsp;</div>
<div>A very simple&nbsp;idea, which I got somewhere in the net,&nbsp; is to create a </div>
<div>Process object p&nbsp; which executes a GHC command-line instruction:</div>
<div>&nbsp;</div>
<div>Process p = Runtime.getRuntime();</div>
<div>p.exec( &quot; ghc M.hs &nbsp;-e \&quot;expr\&quot; &quot; );</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>This&nbsp;would be&nbsp;very simple, if it worked...</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>My problem is that&nbsp; expressions i want to evaluate involve</div>
<div>strings, and GHC command-line&nbsp; 'ghc' misinterprets some special symbols when it&nbsp; parses double quoted strings.&nbsp; </div>
<div>&nbsp;</div>
<div>For instance,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp; ghc -e &nbsp;&quot; reverse \&quot;2&lt;3\&quot; &quot;&nbsp;&nbsp;&nbsp;&nbsp; gives an error!</div>
<div>&nbsp;</div>
<div>Thus any one know a simple way around this?</div>
<div>&nbsp;</div>
<div>The only one obvious to me is to create a temporary</div>
<div>Haskell module M_tmp.hs,&nbsp; with the expression to be evaluated,</div>
<div>which is then executed through&nbsp;&nbsp; a command-line instruction</div>
<div>like</div>
<div>&nbsp;ghc M_tmp.hs&nbsp; -e&nbsp; main</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>