From 781399de4b9fb0f4425ad2a4e6b4fe264917b9a3 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 26 Mar 2018 09:52:37 -0400 Subject: [PATCH 1/2] Whitespace tweaks. --- src/Semantic/Util.hs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index 8fa67c19e..7c8141710 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -143,7 +143,7 @@ evaluatesWith :: forall value term effects -> [Module term] -- ^ List of (blob, term) pairs that make up the program to be evaluated -> Module term -- ^ Entrypoint -> Final effects value -evaluatesWith prelude modules m = runAnalysis @(Evaluating term value) $ do +evaluatesWith prelude modules m = runAnalysis @(Evaluating term value) $ do preludeEnv <- evaluateModule prelude *> getEnv withDefaultEnvironment preludeEnv (withModules modules (evaluateModule m)) @@ -165,6 +165,7 @@ evaluateFilesWithPrelude parser paths = do entry:xs <- traverse (parseFile parser Nothing) paths pure $ evaluatesWith @Value prelude xs entry + -- Read and parse a file. parseFile :: Parser term -> Maybe FilePath -> FilePath -> IO (Module term) parseFile parser rootDir path = runTask $ do From 9c57481efdb50000fcdc45d9b60497cd290bc288 Mon Sep 17 00:00:00 2001 From: Rob Rix Date: Mon, 26 Mar 2018 09:53:25 -0400 Subject: [PATCH 2/2] Fix up prelude use for Python. --- src/Semantic/Util.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Semantic/Util.hs b/src/Semantic/Util.hs index 7c8141710..3c7dc6f3b 100644 --- a/src/Semantic/Util.hs +++ b/src/Semantic/Util.hs @@ -46,8 +46,8 @@ evaluateGoFiles = evaluateFiles goParser typecheckGoFile path = runAnalysis @(Caching Evaluating Go.Term Type) . evaluateModule <$> parseFile goParser Nothing path -- Python -evaluatePythonFile = evaluateFile pythonParser -evaluatePythonFiles = evaluateFiles pythonParser +evaluatePythonFile = evaluateWithPrelude pythonParser +evaluatePythonFiles = evaluateFilesWithPrelude pythonParser typecheckPythonFile path = runAnalysis @(Caching Evaluating Python.Term Type) . evaluateModule <$> parseFile pythonParser Nothing path tracePythonFile path = runAnalysis @(Tracing [] Evaluating Python.Term Value) . evaluateModule <$> parseFile pythonParser Nothing path evaluateDeadTracePythonFile path = runAnalysis @(DeadCode (Tracing [] Evaluating) Python.Term Value) . evaluateModule <$> parseFile pythonParser Nothing path