diff options
author | Marvin Borner | 2022-04-22 00:49:47 +0200 |
---|---|---|
committer | Marvin Borner | 2022-04-22 00:49:47 +0200 |
commit | 3b90d4f15ebad7dc15d78195397559bcca3bd8fb (patch) | |
tree | a2a77a0758fd5c5b6c6fc4d636a5e611101c9427 /src/Eval.hs | |
parent | cf3258b2cf6a7022fcaa26ff071cb4d2a0c9bdec (diff) |
Balanced ternary something
I don't even know anymore. What's happening? Quite confusing.
Diffstat (limited to 'src/Eval.hs')
-rw-r--r-- | src/Eval.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Eval.hs b/src/Eval.hs index c40a118..47ca4ca 100644 --- a/src/Eval.hs +++ b/src/Eval.hs @@ -78,8 +78,16 @@ evalRepl line env = case parse parseReplLine "REPL" line of let (res, env') = evalExp exp `runState` env in outputStrLn (case res of - Left err -> show err - Right exp -> (show exp) <> "\n-> " <> (show $ reduce exp) + Left err -> show err + Right exp -> + "<> " + <> (show exp) + <> "\n*> " + <> (show reduced) + <> "\t(" + <> (show $ ternaryToDecimal reduced) + <> ")" + where reduced = reduce exp ) >> pure env Load path -> |