There is function in python called eval that takes string input and evaluates it.
eval
>>> x = 1 >>> print eval(\'x+1\') 2 >>>
hs-plugins has System.Eval.Haskell.