Skip to content

Commit

Permalink
Touchup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Grant Jeffries committed Nov 4, 2019
1 parent 8145007 commit e0e468e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions bowtie/src/Bowtie/Interpret.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ interpretImpl
interpretImpl libFiles appFile = do

-- Parse

let
parse :: (FilePath, Text) -> Either IError AST
parse =
Expand All @@ -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 =
Expand All @@ -97,7 +95,6 @@ interpretImpl libFiles appFile = do
(Infer.elaborate env dsg)

-- Desugar and erase

let
core :: Core.Expr
core =
Expand All @@ -108,16 +105,13 @@ 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)

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
Expand Down

0 comments on commit e0e468e

Please sign in to comment.