Test uncaught throw, catchless try* . Fix 46 impls.
[jackhill/mal.git] / fsharp / step8_macros.fs
index ea04681..f893f52 100644 (file)
@@ -142,20 +142,10 @@ module REPL
         | node -> node |> eval_ast env
 
     let READ input =
-        try
-            Reader.read_str input
-        with
-        | Error.ReaderError(msg) ->
-            printfn "%s" msg
-            []
+        Reader.read_str input
 
     let EVAL env ast =
-        try
-            Some(eval env ast)
-        with
-        | Error.EvalError(msg) ->
-            printfn "%s" msg
-            None
+        Some(eval env ast)
 
     let PRINT v =
         v
@@ -218,6 +208,13 @@ module REPL
                 match Readline.read "user> " mode with
                 | null -> 0
                 | input ->
-                    REP env input
+                    try
+                        REP env input
+                    with
+                    | Error.EvalError(str)
+                    | Error.ReaderError(str) ->
+                        printfn "Error: %s" str
+                    | ex ->
+                        printfn "Error: %s" (ex.Message)
                     loop ()
             loop ()