shithub: MicroHs

Download patch

ref: d6d8c104da0e1633c1933f800df7cfe75df58df7
parent: c529cdad18e47ad4c960917d749fa5153accc16a
author: Lennart Augustsson <lennart@augustsson.net>
date: Wed Nov 8 10:23:44 EST 2023

Show error message on :reload

--- a/TODO
+++ b/TODO
@@ -50,6 +50,5 @@
 
 
 Bugs
- * :reload doesn't show error message
  * default methods not exported
  * errtest broken
--- a/src/MicroHs/Interactive.hs
+++ b/src/MicroHs/Interactive.hs
@@ -92,9 +92,10 @@
 reload :: I ()
 reload = do
   (ls, _, _) <- get
-  _ <- tryCompile ls   -- reload modules right away
-  return ()
-
+  rld <- tryCompile ls   -- reload modules right away
+  case rld of
+    Left msg -> liftIO $ err msg
+    Right _  -> return ()
 
 helpText :: String
 helpText = "Commands:\n  :quit      quit MicroHs\n  :reload    reload modules\n  :clear     clear all definitions\n  :delete d  delete definition(s) d\n  :help      this text\n  expr       evaluate expression\n  defn       add top level definition\n"
--