A peer-to-peer stack for code collaboration
Repl handles any number of inputs, including 0.
James Henri Haydon95e12607dc0e
diff --git a/rad/repl.rad b/rad/repl.radindex eda4638..ad09dbe 100644--- a/rad/repl.rad+++ b/rad/repl.rad@@ -5,12 +5,12 @@(def read-line-or-exit! (fn [](def line (get-line!))(if (eq? line nil)- (exit!)- (read line))))+ (exit!)+ (read-many line))))(def repl{:name "repl";; Parse errors are thrown here:getter read-line-or-exit!})-(subscribe-to! repl print!)+(subscribe-to! repl (fn [xs] (map print! xs)))diff --git a/src/Radicle/Internal/Effects.hs b/src/Radicle/Internal/Effects.hsindex f1de80e..31d7b62 100644--- a/src/Radicle/Internal/Effects.hs+++ b/src/Radicle/Internal/Effects.hs@@ -154,11 +154,15 @@ replPrimFns = fromList $ allDocs $-- environment in which it was defined, but the-- /result/ of the getter is then evaluated in the-- current environment.- line <- eval =<< (g $$ [])- -- Similarly, the application of the subscriber- -- function is evaluated in the original- -- environment.- void $ withEnv (const e) (fn $$ [quote line])+ y <- g $$ []+ case y of+ Vec ys -> do+ ys' <- traverse eval ys+ -- Similarly, the application of the subscriber+ -- function is evaluated in the original+ -- environment.+ void $ withEnv (const e) (fn $$ [quote (Vec ys')])+ _ -> throwErrorHere $ OtherError "Getter should return a vector of values"_ -> throwErrorHere $ TypeError "subscribe-to!" 0 TDict xxs -> throwErrorHere $ WrongNumberOfArgs "subscribe-to!" 2 (length xs)), ( "read-file!"