diff options
| author | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-03 22:08:25 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-03 22:08:25 +0100 |
| commit | 186785c7bc7d511fef75ec22e72143f7707ae886 (patch) | |
| tree | 6c04fa4f67c61ab04674dc1f1cd69c9d8acd0b98 /lambda-calcul/haskell/src/Minilang/REPL/Run.hs | |
| parent | e26753be1ed978e20ceea5e284fddbbc29f0338e (diff) | |
| download | lambda-nantes-186785c7bc7d511fef75ec22e72143f7707ae886.tar.gz | |
resugar evaluated term
Diffstat (limited to 'lambda-calcul/haskell/src/Minilang/REPL/Run.hs')
| -rw-r--r-- | lambda-calcul/haskell/src/Minilang/REPL/Run.hs | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/lambda-calcul/haskell/src/Minilang/REPL/Run.hs b/lambda-calcul/haskell/src/Minilang/REPL/Run.hs index 37d4dd2..3984dec 100644 --- a/lambda-calcul/haskell/src/Minilang/REPL/Run.hs +++ b/lambda-calcul/haskell/src/Minilang/REPL/Run.hs @@ -15,7 +15,7 @@ import Minilang.Lambda.DeBruijn (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 (desugar, parse) +import Minilang.Lambda.Parser (desugar, parse, resugar) import Minilang.Lambda.Unify (Type (TyVar)) import Minilang.REPL.Types @@ -43,15 +43,16 @@ handleUserInput txt = do Right expr -> do let term = desugar expr v = fromDeBruijn $ eval (toDeBruijn term) + ast = resugar v case language of Typed -> case infer term of Left typeError -> output (Msg $ Infer.render typeError) Right typ -> do let - output (Evaluated v typ) + output (Evaluated ast v typ) Untyped -> - output (Evaluated v (TyVar "<?>")) + output (Evaluated ast v (TyVar "<?>")) handleCommand :: (MonadCatch m, MonadREPL m) => @@ -89,12 +90,4 @@ loadProgramInEnv prog = do Left typeError -> output (Msg $ pack $ show typeError) Right (term, typ, env', context') -> do setEnv (repl {env = env', context = context'}) - output (Evaluated term typ) - where - makeMessage = - "Loaded \"" - <> ( if Text.length prog > 15 - then Text.take 15 prog <> "..." - else prog - ) - <> "\"" + output (Evaluated (resugar term) term typ) |
