From e0e468eabb54949683e72d0a79e92dbd0db599f9 Mon Sep 17 00:00:00 2001 From: Ian Grant Jeffries Date: Mon, 4 Nov 2019 14:06:05 -0500 Subject: [PATCH] Touchup --- bowtie/src/Bowtie/Interpret.hs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/bowtie/src/Bowtie/Interpret.hs b/bowtie/src/Bowtie/Interpret.hs index afc6f1c..f6dd3a5 100644 --- a/bowtie/src/Bowtie/Interpret.hs +++ b/bowtie/src/Bowtie/Interpret.hs @@ -63,7 +63,6 @@ interpretImpl interpretImpl libFiles appFile = do -- Parse - let parse :: (FilePath, Text) -> Either IError AST parse = @@ -72,17 +71,16 @@ interpretImpl libFiles appFile = do libPrograms <- for (hashmapToSortedList libFiles) parse appProgram <- parse appFile - -- Combine - ast <- Bifunctor.first NameClash (concatSource (libPrograms <> [appProgram])) -- PERFORMANCE - -- Kindcheck and infer + pure (ast, inferAndEval ast) + where + inferAndEval :: AST -> Either IError (Environment, Core.Expr, Untyped.Expr) + inferAndEval ast = do - let - res :: Either IError (Environment, Core.Expr, Untyped.Expr) - res = do + -- Kindcheck and infer let env :: Environment env = @@ -97,7 +95,6 @@ interpretImpl libFiles appFile = do (Infer.elaborate env dsg) -- Desugar and erase - let core :: Core.Expr core = @@ -108,7 +105,6 @@ interpretImpl libFiles appFile = do Erase.erase core -- Eval - case Eval.eval mempty untyped of Left e -> panic ("Evaluating failed (this should never happen): " <> show e) @@ -116,8 +112,6 @@ interpretImpl libFiles appFile = do Right val -> pure (env, core, val) - pure (ast, res) - -- | For use by tests or other packages. sourcesToAST :: HashMap FilePath Text -> (FilePath, Text) -> Either IError AST sourcesToAST libFiles appFile = do