diff options
author | Simon Marlow <marlowsd@gmail.com> | 2012-02-13 13:21:42 +0000 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2012-02-13 13:21:42 +0000 |
commit | 1cbd950d105f3e8cd269a671035e1388b9249ba2 (patch) | |
tree | 695733ae34c0ac3f39b25323eda9b434594f2d0b /ghc | |
parent | c61b014d87662b8e95c79316e8aeee985598dd30 (diff) | |
download | haskell-1cbd950d105f3e8cd269a671035e1388b9249ba2.tar.gz |
Revert "Have :load work under -XSafe in GHCi."
This reverts commit 5e9e07a33e17da01245f0cea78e6a6f8a32ac77d.
Reverting to fix validate regression, and pending a redesign of the
changes.
Diffstat (limited to 'ghc')
-rw-r--r-- | ghc/InteractiveUI.hs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs index 3d0adacf6b..8d0205d846 100644 --- a/ghc/InteractiveUI.hs +++ b/ghc/InteractiveUI.hs @@ -1655,9 +1655,7 @@ checkAdd :: Bool -> String -> GHCi (InteractiveImport) checkAdd star mstr = do dflags <- getDynFlags case safeLanguageOn dflags of - True | star -> do - liftIO $ putStrLn "Warning: can't use * imports with Safe Haskell; ignoring *" - checkAdd False mstr + True | star -> ghcError $ CmdLineError "can't use * imports with Safe Haskell" True -> do m <- lookupModule mstr s <- GHC.isModuleTrusted m @@ -1687,8 +1685,8 @@ checkAdd star mstr = do setGHCContextFromGHCiState :: GHCi () setGHCContextFromGHCiState = do st <- getGHCiState - goodTran <- mapMaybeM (tryBool . ok) $ transient_ctx st - goodRemb <- mapMaybeM (tryBool . ok) $ remembered_ctx st + goodTran <- filterM (tryBool . ok) $ transient_ctx st + goodRemb <- filterM (tryBool . ok) $ remembered_ctx st -- drop bad imports so we don't keep replaying it to the user! modifyGHCiState $ \s -> s { transient_ctx = goodTran } modifyGHCiState $ \s -> s { remembered_ctx = goodRemb } @@ -1698,8 +1696,6 @@ setGHCContextFromGHCiState = do ok (IIModule m) = checkAdd True (moduleNameString (moduleName m)) ok (IIDecl d) = checkAdd False (moduleNameString (unLoc (ideclName d))) - mapMaybeM f xs = catMaybes `fmap` sequence (map f xs) - setContext :: [String] -> [String] -> GHCi () setContext starred not_starred = do is1 <- mapM (checkAdd True) starred @@ -2756,12 +2752,12 @@ ghciHandle h m = Haskeline.catch m $ \e -> unblock (h e) ghciTry :: GHCi a -> GHCi (Either SomeException a) ghciTry (GHCi m) = GHCi $ \s -> gtry (m s) -tryBool :: GHCi a -> GHCi (Maybe a) +tryBool :: GHCi a -> GHCi Bool tryBool m = do r <- ghciTry m case r of - Left e -> showException e >> return Nothing - Right a -> return $ Just a + Left e -> showException e >> return False + Right _ -> return True -- ---------------------------------------------------------------------------- -- Utils |