module FileEval where import Eval import Parser import Research import System.IO import qualified Data.Map as Map evaluateFileResult :: FilePath -> IO T evaluateFileResult filePath = do contents <- readFile filePath let asts = parseTricu contents let finalEnv = evalTricu Map.empty asts case Map.lookup "__result" finalEnv of Just finalResult -> return finalResult Nothing -> error "No result found in final environment" evaluateFile :: FilePath -> IO Env evaluateFile filePath = do contents <- readFile filePath let asts = parseTricu contents pure $ evalTricu Map.empty asts evaluateFileWithContext :: Env -> FilePath -> IO Env evaluateFileWithContext env filePath = do contents <- readFile filePath let asts = parseTricu contents pure $ evalTricu env asts