diff options
| author | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-02 21:38:48 +0100 |
|---|---|---|
| committer | Arnaud Bailly <arnaud@pankzsoft.com> | 2025-11-02 21:38:48 +0100 |
| commit | 6aab2439095f27a8f4c754343f8d8f6674576c2c (patch) | |
| tree | 47aa9ad5c8c9cc4b0eb71171909c0de76a679b9d /lambda-calcul | |
| parent | fc00cff556372e914d3cf15c39700b4ff7c3541c (diff) | |
| download | lambda-nantes-6aab2439095f27a8f4c754343f8d8f6674576c2c.tar.gz | |
better rendering for evaluation output
Diffstat (limited to 'lambda-calcul')
| -rw-r--r-- | lambda-calcul/haskell/public/repl.js | 4 | ||||
| -rw-r--r-- | lambda-calcul/haskell/src/Minilang/REPL/Net.hs | 9 |
2 files changed, 11 insertions, 2 deletions
diff --git a/lambda-calcul/haskell/public/repl.js b/lambda-calcul/haskell/public/repl.js index 599d1f8..1d4453f 100644 --- a/lambda-calcul/haskell/public/repl.js +++ b/lambda-calcul/haskell/public/repl.js @@ -51,7 +51,9 @@ function appendOutput(text) { function formatResult(text) { const result = JSON.parse(text); - if (result.tag === "Msg") { + if (result.rendered) { + return result.rendered; + } else if (result.tag === "Msg" ) { return result.contents; } return text; diff --git a/lambda-calcul/haskell/src/Minilang/REPL/Net.hs b/lambda-calcul/haskell/src/Minilang/REPL/Net.hs index 1bafeaa..43d2560 100644 --- a/lambda-calcul/haskell/src/Minilang/REPL/Net.hs +++ b/lambda-calcul/haskell/src/Minilang/REPL/Net.hs @@ -24,6 +24,7 @@ import Data.Text.Encoding (decodeUtf8With) import Data.Text.Encoding.Error (lenientDecode) import Minilang.Log import Minilang.REPL (withInputs) +import Minilang.REPL.Pure (render) import Minilang.REPL.Purer (purerREPL) import Minilang.REPL.Run (runREPL) import Minilang.REPL.Types @@ -92,7 +93,13 @@ instance MonadREPL (Net IO) where output a = do gets connection >>= lift . wsSend a - netLog (object ["action" .= ("output" :: Text), "content" .= a]) + netLog + ( object + [ "action" .= ("output" :: Text), + "content" .= a, + "rendered" .= render a + ] + ) prompt = pure () getEnv = gets repl >>= lift . readTVarIO |
