The mueval package

Mueval is a Haskell interpreter. It
uses the GHC API to evaluate arbitrary Haskell expressions.
Importantly, mueval takes many precautions to defang and avoid "evil"
code. It uses resource limits, whitelisted modules and Safe Haskell,
special Show instances for IO, threads, processes, and changes of directory
to sandbox the Haskell code.

It is, in short, intended to be a standalone version of Lambdabot's famous
evaluation functionality. For examples and explanations, please see the README file.