summaryrefslogtreecommitdiff
path: root/lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs
diff options
context:
space:
mode:
authorArnaud Bailly <arnaud@pankzsoft.com>2025-11-02 21:35:19 +0100
committerArnaud Bailly <arnaud@pankzsoft.com>2025-11-02 21:35:19 +0100
commitfc00cff556372e914d3cf15c39700b4ff7c3541c (patch)
tree52a66d4e02a6f22748331b7eee72892e378a548b /lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs
parent1294be22324f012e96fd1b9d5935563505c080be (diff)
downloadlambda-nantes-fc00cff556372e914d3cf15c39700b4ff7c3541c.tar.gz
better rendering for type errors and evaluation
Diffstat (limited to 'lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs')
-rw-r--r--lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs9
1 files changed, 2 insertions, 7 deletions
diff --git a/lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs b/lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs
index cbc7988..3583020 100644
--- a/lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs
+++ b/lambda-calcul/haskell/src/Minilang/REPL/Haskeline.hs
@@ -29,6 +29,7 @@ import System.Console.Haskeline
import System.Directory (listDirectory)
import Minilang.Lambda.Parser (resugar, pretty)
import qualified Minilang.Lambda.Unify as Unify
+import Minilang.REPL.Pure (render)
-- * Haskeline REPL
@@ -44,19 +45,13 @@ instance MonadREPL Haskeline where
case i of
Nothing -> pure EOF
Just (pack -> t) -> pure $ interpret t
- output = hoist . outputStrLn . render
+ output = hoist . outputStrLn . unpack . render
prompt = pure ()
load = fmap (first FileError) . hoist . lift . try . Text.readFile . unpack
getEnv = get
setEnv = put
-render :: Out -> String
-render = \case
- Msg t -> unpack t
- Evaluated term typ -> unpack $ pretty (resugar term) <> " : " <> Unify.pretty typ
- other -> show other
-
completion :: CompletionFunc IO
completion = completion' . first reverse