Skip to content

Instantly share code, notes, and snippets.

@seliopou
Created November 5, 2012 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seliopou/4015093 to your computer and use it in GitHub Desktop.
Save seliopou/4015093 to your computer and use it in GitHub Desktop.
Boilerplate module for dynamically compiling, loading, and evaluating Haskell code using hint.
-- Boilerplate module for dynamic compilation, loading, and evaluation of
-- modules using hint.
--
-- Load and play around with this file using:
--
-- ghci -package hint HintExample.hs
--
module HintExample where
import Language.Haskell.Interpreter
evalWithModule file modul name = do
result <- runInterpreter $ do
loadModules [file]
interpret (modul ++ "." ++ name) undefined
case result of
Left _ -> return Nothing
Right v -> return $ Just v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment