Last active
December 18, 2015 00:49
-
-
Save co-dan/5699706 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Language.Haskell.Interpreter | |
import MyModule | |
main = do | |
r <- runInterpreter interp | |
case r of | |
Left err -> print $ show err | |
Right res -> print res | |
interp :: Interpreter IntBox | |
interp = do | |
set [searchPath := ["."]] | |
loadModules ["*MyModule.hs"] | |
setTopLevelModules ["MyModule"] | |
interpret ("testIB") (as :: IntBox) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, DeriveDataTypeable #-} | |
module MyModule where | |
import Data.Typeable | |
data IntBox = IB Int | |
deriving (Typeable, Show) | |
testIB = IB 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment