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