diff options
Diffstat (limited to 'compiler/GHC/Runtime')
-rw-r--r-- | compiler/GHC/Runtime/Eval.hs | 21 | ||||
-rw-r--r-- | compiler/GHC/Runtime/Heap/Inspect.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Runtime/Interpreter.hs | 20 | ||||
-rw-r--r-- | compiler/GHC/Runtime/Linker.hs | 8 | ||||
-rw-r--r-- | compiler/GHC/Runtime/Loader.hs | 3 |
5 files changed, 27 insertions, 27 deletions
diff --git a/compiler/GHC/Runtime/Eval.hs b/compiler/GHC/Runtime/Eval.hs index 337cd24d80..db0c9928ce 100644 --- a/compiler/GHC/Runtime/Eval.hs +++ b/compiler/GHC/Runtime/Eval.hs @@ -1,5 +1,7 @@ -{-# LANGUAGE CPP, MagicHash, RecordWildCards, BangPatterns #-} +{-# LANGUAGE BangPatterns #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE RecordWildCards #-} {-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-} @@ -436,7 +438,7 @@ resumeExec canLogSpan step , resumeBindings = bindings, resumeFinalIds = final_ids , resumeApStack = apStack, resumeBreakInfo = mb_brkpt , resumeSpan = span - , resumeHistory = hist } -> do + , resumeHistory = hist } -> withVirtualCWD $ do status <- liftIO $ GHCi.resumeStmt hsc_env (isStep step) fhv let prevHistoryLst = fromListBL 50 hist @@ -630,8 +632,7 @@ rttiEnvironment hsc_env@HscEnv{hsc_IC=ic} = do [id | id <- tmp_ids , not $ noSkolems id , (occNameFS.nameOccName.idName) id /= result_fs] - hsc_env' <- foldM improveTypes hsc_env (map idName incompletelyTypedIds) - return hsc_env' + foldM improveTypes hsc_env (map idName incompletelyTypedIds) where noSkolems = noFreeVarsOfType . idType improveTypes hsc_env@HscEnv{hsc_IC=ic} name = do @@ -870,7 +871,7 @@ getInfo allInfo name -- | Returns all names in scope in the current interactive context getNamesInScope :: GhcMonad m => m [Name] -getNamesInScope = withSession $ \hsc_env -> do +getNamesInScope = withSession $ \hsc_env -> return (map gre_name (globalRdrEnvElts (ic_rn_gbl_env (hsc_IC hsc_env)))) -- | Returns all 'RdrName's in scope in the current interactive @@ -917,7 +918,7 @@ isImport pflags stmt = -- | Returns @True@ if passed string is a declaration but __/not a splice/__. isDecl :: ParserOpts -> String -> Bool -isDecl pflags stmt = do +isDecl pflags stmt = case parseThing Parser.parseDeclaration pflags stmt of Lexer.POk _ thing -> case unLoc thing of @@ -1011,7 +1012,7 @@ exprType mode expr = withSession $ \hsc_env -> do -- | Get the kind of a type typeKind :: GhcMonad m => Bool -> String -> m (Type, Kind) -typeKind normalise str = withSession $ \hsc_env -> do +typeKind normalise str = withSession $ \hsc_env -> liftIO $ hscKcType hsc_env normalise str -- ---------------------------------------------------------------------------- @@ -1062,8 +1063,8 @@ typeKind normalise str = withSession $ \hsc_env -> do -- Find all instances that match a provided type getInstancesForType :: GhcMonad m => Type -> m [ClsInst] -getInstancesForType ty = withSession $ \hsc_env -> do - liftIO $ runInteractiveHsc hsc_env $ do +getInstancesForType ty = withSession $ \hsc_env -> + liftIO $ runInteractiveHsc hsc_env $ ioMsgMaybe $ runTcInteractive hsc_env $ do -- Bring class and instances from unqualified modules into scope, this fixes #16793. loadUnqualIfaces hsc_env (hsc_IC hsc_env) @@ -1204,7 +1205,7 @@ checkForExistence clsInst mb_inst_tys = do -- | Parse an expression, the parsed expression can be further processed and -- passed to compileParsedExpr. parseExpr :: GhcMonad m => String -> m (LHsExpr GhcPs) -parseExpr expr = withSession $ \hsc_env -> do +parseExpr expr = withSession $ \hsc_env -> liftIO $ runInteractiveHsc hsc_env $ hscParseExpr expr -- | Compile an expression, run it, and deliver the resulting HValue. diff --git a/compiler/GHC/Runtime/Heap/Inspect.hs b/compiler/GHC/Runtime/Heap/Inspect.hs index 34c55760ac..8de6a0d39d 100644 --- a/compiler/GHC/Runtime/Heap/Inspect.hs +++ b/compiler/GHC/Runtime/Heap/Inspect.hs @@ -1019,7 +1019,7 @@ cvReconstructType hsc_env max_depth old_ty hval = runTR_maybe hsc_env $ do traceTR (text "Constr1" <+> ppr dcname) (mb_dc, _) <- tryTc (tcLookupDataCon dcname) case mb_dc of - Nothing-> do + Nothing-> forM pArgs $ \x -> do tv <- newVar liftedTypeKind return (tv, x) diff --git a/compiler/GHC/Runtime/Interpreter.hs b/compiler/GHC/Runtime/Interpreter.hs index 6cd00efdd2..5213b02a4f 100644 --- a/compiler/GHC/Runtime/Interpreter.hs +++ b/compiler/GHC/Runtime/Interpreter.hs @@ -191,7 +191,7 @@ iservCmd hsc_env msg = withInterp hsc_env $ \case InternalInterp -> run msg -- Just run it directly #endif (ExternalInterp c i) -> withIServ_ c i $ \iserv -> - uninterruptibleMask_ $ do -- Note [uninterruptibleMask_] + uninterruptibleMask_ $ -- Note [uninterruptibleMask_] iservCall iserv msg @@ -223,7 +223,7 @@ hscInterp hsc_env = case hsc_interp hsc_env of withIServ :: (ExceptionMonad m) => IServConfig -> IServ -> (IServInstance -> m (IServInstance, a)) -> m a -withIServ conf (IServ mIServState) action = do +withIServ conf (IServ mIServState) action = MC.mask $ \restore -> do state <- liftIO $ takeMVar mIServState @@ -286,7 +286,7 @@ resumeStmt hsc_env step resume_ctxt = do handleEvalStatus hsc_env status abandonStmt :: HscEnv -> ForeignRef (ResumeContext [HValueRef]) -> IO () -abandonStmt hsc_env resume_ctxt = do +abandonStmt hsc_env resume_ctxt = withForeignRef resume_ctxt $ \rhv -> iservCmd hsc_env (AbandonStmt rhv) @@ -300,24 +300,24 @@ handleEvalStatus hsc_env status = EvalComplete alloc <$> addFinalizer res where addFinalizer (EvalException e) = return (EvalException e) - addFinalizer (EvalSuccess rs) = do + addFinalizer (EvalSuccess rs) = EvalSuccess <$> mapM (mkFinalizedHValue hsc_env) rs -- | Execute an action of type @IO ()@ evalIO :: HscEnv -> ForeignHValue -> IO () -evalIO hsc_env fhv = do +evalIO hsc_env fhv = liftIO $ withForeignRef fhv $ \fhv -> iservCmd hsc_env (EvalIO fhv) >>= fromEvalResult -- | Execute an action of type @IO String@ evalString :: HscEnv -> ForeignHValue -> IO String -evalString hsc_env fhv = do +evalString hsc_env fhv = liftIO $ withForeignRef fhv $ \fhv -> iservCmd hsc_env (EvalString fhv) >>= fromEvalResult -- | Execute an action of type @String -> IO String@ evalStringToIOString :: HscEnv -> ForeignHValue -> String -> IO String -evalStringToIOString hsc_env fhv str = do +evalStringToIOString hsc_env fhv str = liftIO $ withForeignRef fhv $ \fhv -> iservCmd hsc_env (EvalStringToString fhv str) >>= fromEvalResult @@ -379,12 +379,12 @@ newBreakArray hsc_env size = do mkFinalizedHValue hsc_env breakArray enableBreakpoint :: HscEnv -> ForeignRef BreakArray -> Int -> Bool -> IO () -enableBreakpoint hsc_env ref ix b = do +enableBreakpoint hsc_env ref ix b = withForeignRef ref $ \breakarray -> iservCmd hsc_env (EnableBreakpoint breakarray ix b) breakpointStatus :: HscEnv -> ForeignRef BreakArray -> Int -> IO Bool -breakpointStatus hsc_env ref ix = do +breakpointStatus hsc_env ref ix = withForeignRef ref $ \breakarray -> iservCmd hsc_env (BreakpointStatus breakarray ix) @@ -408,7 +408,7 @@ seqHValue hsc_env ref = -- | Process the result of a Seq or ResumeSeq message. #2950 handleSeqHValueStatus :: HscEnv -> EvalStatus () -> IO (EvalResult ()) -handleSeqHValueStatus hsc_env eval_status = do +handleSeqHValueStatus hsc_env eval_status = case eval_status of (EvalBreak is_exception _ ix mod_uniq resume_ctxt _) -> do -- A breakpoint was hit; inform the user and tell them diff --git a/compiler/GHC/Runtime/Linker.hs b/compiler/GHC/Runtime/Linker.hs index 4203f741c6..dd3c29caa5 100644 --- a/compiler/GHC/Runtime/Linker.hs +++ b/compiler/GHC/Runtime/Linker.hs @@ -243,7 +243,7 @@ withExtendedLinkEnv dl new_env action -- lose those changes (we might have linked a new module or -- package), so the reset action only removes the names we -- added earlier. - reset_old_env = liftIO $ do + reset_old_env = liftIO $ modifyPLS_ dl $ \pls -> let cur = closure_env pls new = delListFromNameEnv cur (map fst new_env) @@ -313,7 +313,7 @@ linkCmdLineLibs :: HscEnv -> IO () linkCmdLineLibs hsc_env = do let dl = hsc_dynLinker hsc_env initDynLinker hsc_env - modifyPLS_ dl $ \pls -> do + modifyPLS_ dl $ \pls -> linkCmdLineLibs' hsc_env pls linkCmdLineLibs' :: HscEnv -> PersistentLinkerState -> IO PersistentLinkerState @@ -915,7 +915,7 @@ dynLinkObjs hsc_env pls objs = do -- If resolving failed, unload all our -- object modules and carry on - if succeeded ok then do + if succeeded ok then return (pls1, Succeeded) else do pls2 <- unload_wkr hsc_env [] pls1 @@ -1259,7 +1259,7 @@ linkPackages hsc_env new_pkgs = do -- a lock. initDynLinker hsc_env let dl = hsc_dynLinker hsc_env - modifyPLS_ dl $ \pls -> do + modifyPLS_ dl $ \pls -> linkPackages' hsc_env new_pkgs pls linkPackages' :: HscEnv -> [UnitId] -> PersistentLinkerState diff --git a/compiler/GHC/Runtime/Loader.hs b/compiler/GHC/Runtime/Loader.hs index 2a97e24edd..3b487e7b1a 100644 --- a/compiler/GHC/Runtime/Loader.hs +++ b/compiler/GHC/Runtime/Loader.hs @@ -80,8 +80,7 @@ initializePlugins hsc_env df | otherwise = do loadedPlugins <- loadPlugins (hsc_env { hsc_dflags = df }) let df' = df { cachedPlugins = loadedPlugins } - df'' <- withPlugins df' runDflagsPlugin df' - return df'' + withPlugins df' runDflagsPlugin df' where argumentsForPlugin p = map snd . filter ((== lpModuleName p) . fst) runDflagsPlugin p opts dynflags = dynflagsPlugin p opts dynflags |