Well, it depends on the language. Some are quite good at restricting programs so that it is not possible to execute arbitrary code.
Take a look at https://propellor.branchable.com to see how Haskell might be used.
Idris might be a good candidate as well.
https://dhall-lang.org is quite interesting for these purposes as well (although it is not general purpose)