userDefinedFunction = "\x -> x*x :: Int"
main = do
f <- complileFunction userDefinedFunction :: Int -> Int
let results = map f [1,2,3,4]
print $ show results
How to do it securely? userDefinedFunction
is supposed to be untrusted third-party code. It should be built to fast, optimized code, but should not be able to access system directly.
I suppose it should combine Safe Haskell and System.Eval.Haskell. Are there any projects or tutorials covering this?
There is a wiki page for exactly this use case You could also have a look at lambdabots source code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With