git @ Cat's Eye Technologies Robin / ce38bc1
Make it less less-than-fantastic. Chris Pressey 5 years ago
3 changed file(s) with 4 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
2727 showResults results =
2828 (foldl (\a x -> x ++ "\n" ++ a) "" (map (showResult) results))
2929 showResult (Right result) = show result
30 showResult (Left result) = "ERROR: " ++ (show result)
30 showResult (Left result) = "uncaught exception: " ++ (show result)
1010 collect ((List [Symbol "display", expr]):rest) env reactors results =
1111 let
1212 result = case eval (IEnv catchException) env expr id of
13 e@(List [(Symbol "uncaught-exception"), expr]) -> Left e
13 -- TODO This is less than fantastic. Should we have a dedicated error Expr?
14 e@(List [(Symbol "uncaught-exception"), expr]) -> Left expr
1415 other -> Right other
1516 in
1617 collect rest env reactors (result:results)
44 import System.Environment
55 import System.Exit
66
7 import Language.Robin.Expr
87 import Language.Robin.Env (mergeEnvs)
98 import Language.Robin.Parser (parseRobin)
109 import Language.Robin.Intrinsics (robinIntrinsics)
5352 writeResults ((Right result):results) = do
5453 putStrLn $ show result
5554 writeResults results
56 writeResults ((Left (List [(Symbol "uncaught-exception"), expr])):results) =
55 writeResults ((Left expr):results) =
5756 error $ "uncaught exception: " ++ show expr
58 writeResults ((Left expr):results) =
59 error $ show expr
6057
6158
6259 runReactors [] showEvents = return ()