diff options
| author | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-05 12:02:23 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-05 12:02:23 +0100 |
| commit | 99e2ce71faa82e7b99574895e0fe24183ba9f6c3 (patch) | |
| tree | 10538bb91d187a3c1d281a87a3974a6036f2ad2f /lambda-calcul/haskell/src/Minilang/REPL | |
| parent | 438e3f8c5dcdfeead15a6a9a1760f7c254fc54b2 (diff) | |
| download | lambda-nantes-99e2ce71faa82e7b99574895e0fe24183ba9f6c3.tar.gz | |
can parse whole programs and load them
Diffstat (limited to 'lambda-calcul/haskell/src/Minilang/REPL')
| -rw-r--r-- | lambda-calcul/haskell/src/Minilang/REPL/Run.hs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lambda-calcul/haskell/src/Minilang/REPL/Run.hs b/lambda-calcul/haskell/src/Minilang/REPL/Run.hs index a98ff41..bf28b23 100644 --- a/lambda-calcul/haskell/src/Minilang/REPL/Run.hs +++ b/lambda-calcul/haskell/src/Minilang/REPL/Run.hs @@ -14,7 +14,7 @@ import Minilang.Lambda.DeBruijn (eval, eval', fromDeBruijn, toDeBruijn) import Minilang.Lambda.Eval (newEnv) import Minilang.Lambda.Infer (infer, newContext) import qualified Minilang.Lambda.Infer as Infer -import Minilang.Lambda.Parser (AST (..), desugar, parse, resugar) +import Minilang.Lambda.Parser (AST (..), desugar, parse, parseProgram, resugar) import Minilang.Lambda.Unify (Type (TyVar)) import Minilang.REPL.Types @@ -95,11 +95,11 @@ loadProgramInEnv :: m () loadProgramInEnv prog = do repl@REPLEnv {env, context, language} <- getEnv - case parse prog of + case parseProgram prog of Left err -> output (Msg $ pack $ show err) - Right e -> do - case loadProgram language e env context of + Right exprs -> do + case loadProgram language env context exprs of Left typeError -> output (Msg $ pack $ show typeError) - Right (term, typ, env', context') -> do + Right (results, env', context') -> do setEnv (repl {env = env', context = context'}) - output (Evaluated (resugar term) term typ) + mapM_ (\(term, typ) -> output (Evaluated (resugar term) term typ)) results |
