From 5dc6a6f7b89d2ad371994b1e56fe96d680ffde0b Mon Sep 17 00:00:00 2001 From: Dougal Maclaurin Date: Sat, 19 Dec 2020 23:44:20 -0500 Subject: Add an IO effect, modeled as `{State World}` with a special `World` token. The goal is to let us sequence effectful FFI calls, without worrying about reordering and DCE, and then wrap the sequence in `unsafePerformIO` to expose it as a pure function. --- src/dex.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dex.hs') diff --git a/src/dex.hs b/src/dex.hs index 9c36c9ae..c0b73f6d 100644 --- a/src/dex.hs +++ b/src/dex.hs @@ -62,7 +62,7 @@ runMode evalMode preludeFile opts = do exportFunctions objPath exportedFuns env opts evalPrelude :: EvalConfig -> Maybe FilePath -> IO TopEnv -evalPrelude opts fname = flip execStateT mempty $ do +evalPrelude opts fname = flip execStateT initTopEnv $ do source <- case fname of Nothing -> return $ preludeSource Just path -> liftIO $ readFile path -- cgit v1.2.3-70-g09d2