changeset 5:17f5b8304641

Fix evalWithWriter
author atton
date Wed, 26 Oct 2016 08:39:14 +0000
parents 783541c5ee42
children ffa168243916
files arith/Arith.hs
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/arith/Arith.hs	Wed Oct 26 08:32:05 2016 +0000
+++ b/arith/Arith.hs	Wed Oct 26 08:39:14 2016 +0000
@@ -43,9 +43,11 @@
 eval1 t                     = Left $ "Cannot eval: " ++ show t
 
 
+evalWithWriter :: Term -> Writer String ()
 evalWithWriter t = do
+  tell $ (show t) ++ "\n"
   case (eval1 t) of
-     (Right t') -> (tell $ show t ++ "\n") >> (evalWithWriter t')
+     (Right t') -> evalWithWriter t'
      (Left  s)  -> tell $ s
 
 evalWithStep :: Term -> String