summaryrefslogtreecommitdiff
path: root/iserv
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2016-06-22 18:13:48 +0100
committerSimon Marlow <marlowsd@gmail.com>2016-06-24 11:29:33 +0100
commitbdb0d24be9c83b08fd3f4b870a17f6be31a24b1b (patch)
tree3b672403a106a655a71ee061c361ae558e042605 /iserv
parentd2006d050e7a9111c0c448d6262f8994ef5761b7 (diff)
downloadhaskell-bdb0d24be9c83b08fd3f4b870a17f6be31a24b1b.tar.gz
Remote GHCi: separate out message types
Summary: From a suggestion by @goldfire: clean up the message types, so that rather than one Message type with all the messages, we have a separate THMessage type for messages sent back to GHC during TH execution. At the same time I also removed the QDone/QFailed/QException messages into their own type, and made the result type of RunTH more accurate. Test Plan: validate Reviewers: goldfire, ezyang, austin, niteria, bgamari, erikd Subscribers: thomie, goldfire Differential Revision: https://phabricator.haskell.org/D2356
Diffstat (limited to 'iserv')
-rw-r--r--iserv/src/Main.hs12
1 files changed, 4 insertions, 8 deletions
diff --git a/iserv/src/Main.hs b/iserv/src/Main.hs
index 46ae82b464..2e4555b017 100644
--- a/iserv/src/Main.hs
+++ b/iserv/src/Main.hs
@@ -58,21 +58,17 @@ serv verbose pipe@Pipe{..} restore = loop
wrapRunTH :: forall a. (Binary a, Show a) => IO a -> IO ()
wrapRunTH io = do
r <- try io
+ writePipe pipe (putTHMessage RunTHDone)
case r of
Left e
| Just (GHCiQException _ err) <- fromException e -> do
- when verbose $ putStrLn "iserv: QFail"
- writePipe pipe (putMessage (QFail err))
- loop
+ reply (QFail err :: QResult a)
| otherwise -> do
- when verbose $ putStrLn "iserv: QException"
str <- showException e
- writePipe pipe (putMessage (QException str))
- loop
+ reply (QException str :: QResult a)
Right a -> do
when verbose $ putStrLn "iserv: QDone"
- writePipe pipe (putMessage QDone)
- reply a
+ reply (QDone a)
-- carefully when showing an exception, there might be other exceptions
-- lurking inside it. If so, we return the inner exception instead.