diff options
author | Reid Barton <rwbarton@gmail.com> | 2014-12-23 16:16:29 -0500 |
---|---|---|
committer | Reid Barton <rwbarton@gmail.com> | 2014-12-23 16:16:29 -0500 |
commit | cc510b46b4f6046115cd74acc2c8726c91823bcf (patch) | |
tree | b52fb8532fde8d9b69f9251ffb4a090e58590856 /ghc/GhciMonad.hs | |
parent | 878910e1c4520732ab9d8372c1c81f00d484e48f (diff) | |
download | haskell-cc510b46b4f6046115cd74acc2c8726c91823bcf.tar.gz |
Make ghc -e fail on invalid declarations
Summary:
Note: This commit includes an API change to GhciMonad.runDecls
to allow the caller to determine whether the declarations were
run successfully or not.
Test Plan: harbormaster
Reviewers: austin
Reviewed By: austin
Subscribers: carter, thomie
Differential Revision: https://phabricator.haskell.org/D582
Diffstat (limited to 'ghc/GhciMonad.hs')
-rw-r--r-- | ghc/GhciMonad.hs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ghc/GhciMonad.hs b/ghc/GhciMonad.hs index f57fbba101..19b900995a 100644 --- a/ghc/GhciMonad.hs +++ b/ghc/GhciMonad.hs @@ -277,15 +277,17 @@ runStmt expr step = do r <- GHC.runStmtWithLocation (progname st) (line_number st) expr step return (Just r) -runDecls :: String -> GHCi [GHC.Name] +runDecls :: String -> GHCi (Maybe [GHC.Name]) runDecls decls = do st <- getGHCiState reifyGHCi $ \x -> withProgName (progname st) $ withArgs (args st) $ reflectGHCi x $ do - GHC.handleSourceError (\e -> do GHC.printException e; return []) $ do - GHC.runDeclsWithLocation (progname st) (line_number st) decls + GHC.handleSourceError (\e -> do GHC.printException e; + return Nothing) $ do + r <- GHC.runDeclsWithLocation (progname st) (line_number st) decls + return (Just r) resume :: (SrcSpan -> Bool) -> GHC.SingleStep -> GHCi GHC.RunResult resume canLogSpan step = do |