module Mueval.Context (cleanModules, defaultModules) where

import Data.List (elem)

-- | Return false if any of the listed modules cannot be found in the whitelist.
cleanModules :: [String] -> Bool
cleanModules = and . map (`elem` safeModules)

{- | Modules which we should load by default. These are of course whitelisted.
   Specifically, we want the Prelude because otherwise things are horribly
   crippled; we want SimpleReflect so we can do neat things (for said neat
   things, see
   and we want ShowQ and ShowFun to neuter IO stuff even more. -}
defaultModules :: [String]
defaultModules = ["Prelude", "ShowQ", "ShowFun", "SimpleReflect"]

-- | Borrowed from Lambdabot, this is the whitelist of modules which should be
--   safe to import functions from.
safeModules :: [String]
safeModules = defaultModules ++ ["Control.Applicative",