Skip to content

Commit

Permalink
runtime: add CEK Evaluator
Browse files Browse the repository at this point in the history
- on track for #108
  • Loading branch information
doyougnu committed Jun 2, 2024
1 parent 9cc4dab commit b2de4f2
Show file tree
Hide file tree
Showing 5 changed files with 659 additions and 336 deletions.
11 changes: 4 additions & 7 deletions repl/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
{-# LANGUAGE ViewPatterns #-}
module Main where

import Control.Exception
import Control.Exception hiding (evaluate)
import Control.Lens hiding (argument)
import Control.Monad
import Control.Monad.Trans.Reader
import Control.Monad.Trans.Except

import Data.Foldable (for_)
import Data.IORef
Expand Down Expand Up @@ -148,7 +146,6 @@ repl ctx startWorld = do
prettyPrint expr
putStrLn ""
currentWorld <- readIORef theWorld
runExceptT (runReaderT (runEval (eval expr)) (phaseEnv runtime currentWorld)) >>=
\case
Left evalErr -> print evalErr
Right val -> prettyPrintLn val
case evaluateIn (phaseEnv runtime currentWorld) expr of
Left evalErr -> print $ erroneousValue $ projectError evalErr
Right val -> prettyPrintLn val
Loading

0 comments on commit b2de4f2

Please sign in to comment.