Ticket #7625: 0001-Allow-multiple-import-statements-on-one-line-in-GHCi.patch

File 0001-Allow-multiple-import-statements-on-one-line-in-GHCi.patch, 2.4 KB (added by parcs, 3 years ago)
  • compiler/main/HscMain.hs

    From 223177e94e52327ce7db54d1e47626736b875ea4 Mon Sep 17 00:00:00 2001
    From: Patrick Palka <[email protected]>
    Date: Fri, 25 Jan 2013 09:37:56 -0500
    Subject: [PATCH] Allow multiple import statements on one line in GHCi (#7625)
    
    ---
     compiler/main/HscMain.hs         |    8 ++++----
     compiler/main/InteractiveEval.hs |    2 +-
     ghc/InteractiveUI.hs             |    4 ++--
     3 files changed, 7 insertions(+), 7 deletions(-)
    
    diff --git a/compiler/main/HscMain.hs b/compiler/main/HscMain.hs
    index 3562f27..bc27716 100644
    a b hscDeclsWithLocation hsc_env0 str source linenumber = 
    16031603
    16041604    return (tythings, ictxt)
    16051605
    1606 hscImport :: HscEnv -> String -> IO (ImportDecl RdrName)
     1606hscImport :: HscEnv -> String -> IO [ImportDecl RdrName]
    16071607hscImport hsc_env str = runInteractiveHsc hsc_env $ do
    16081608    (L _ (HsModule{hsmodImports=is})) <-
    16091609       hscParseThing parseModule str
    1610     case is of
    1611         [i] -> return (unLoc i)
    1612         _ -> liftIO $ throwOneError $
     1610    if null is
     1611        then liftIO $ throwOneError $
    16131612                 mkPlainErrMsg (hsc_dflags hsc_env) noSrcSpan $
    16141613                     ptext (sLit "parse error in import declaration")
     1614        else return (map unLoc is)
    16151615
    16161616-- | Typecheck an expression (but don't run it)
    16171617hscTcExpr :: HscEnv
  • compiler/main/InteractiveEval.hs

    diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
    index 7fa156a..d2e5c42 100644
    a b withVirtualCWD m = do 
    267267
    268268  gbracket set_cwd reset_cwd $ \_ -> m
    269269
    270 parseImportDecl :: GhcMonad m => String -> m (ImportDecl RdrName)
     270parseImportDecl :: GhcMonad m => String -> m [ImportDecl RdrName]
    271271parseImportDecl expr = withSession $ \hsc_env -> liftIO $ hscImport hsc_env expr
    272272
    273273emptyHistory :: Int -> BoundedList History
  • ghc/InteractiveUI.hs

    diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
    index 9327546..5239a7e 100644
    a b setContext starred unstarred = restoreContextOnFailure $ do 
    17021702
    17031703addImportToContext :: String -> GHCi ()
    17041704addImportToContext str = restoreContextOnFailure $ do
    1705   idecl <- GHC.parseImportDecl str
    1706   addII (IIDecl idecl)   -- #5836
     1705  idecls <- GHC.parseImportDecl str
     1706  forM_ idecls $ \idecl -> addII (IIDecl idecl)   -- #5836
    17071707  setGHCContextFromGHCiState
    17081708
    17091709-- Util used by addImportToContext and addModulesToContext