Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: igloo Type: feature request | Status: new Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Comment(by simonmar): Replying to [comment:20 SamAnklesaria]: Thanks for the comments. `parseName` relies internally on a function from HscMain that does just that: name parsing. I don't think it can handle import declarations, which is why I wrote `hscImport`. Yes - I'm just suggesting that instead of `getImportDecl` you call it `parseImportDecl` and make it parse a complete import declaration for consistency. As I removed the import from the string the user entered (saving all the import parts in a `remembered_ctx` seems redundant), it needs to be prepended or the parser won't understand it. My suggestion is to not remove it in the first place, that seems simpler. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: igloo Type: feature request | Status: patch Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by SamAnklesaria): * status: new = patch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: igloo Type: feature request | Status: new Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Comment(by simonmar): Many thanks for the patch! I've done a patch review, there are a few things that need fixing, but nothing fatal. {{{ - throwOneError (mkPlainErrMsg noSrcSpan (ptext (sLit No module speficied for import))) }}} typo in the error message, and perhaps the message should say something like parse error in import declaration? {{{ + -- 'ic_toplev_scope', 'ic_exports' and 'ic_imports' }}} did that sneak in by mistake? I don't see `ic_imports` anywhere {{{ +getImportDecl :: GhcMonad m = String - m (ImportDecl RdrName) +getImportDecl expr = withSession $ \hsc_env - hscImport hsc_env (import++expr) }}} Did you really want `import++expr`, with no space between? I'd drop the `import++` bit entirely, I think, and call the function `parseImportDecl` (we already have `parseName`, which is similar). {{{ - | [import, mod] - words stmt= keepGoing' setContext ('+':mod) + | ('i':'m':'p':'o':'r':'t':mod) - stmt= keepGoing' (importContext True) mod }}} check for a space after import, otherwise you'll catch imported etc. What happens if the user imports the same module twice, with different import lists? They should accumulate, as in a source file, right? Does it work that way? What happens if you import a module multiple times with import, and then say :m -M? In `setContext` and `remembered_ctx` it feels to me like an import decl should be a different kind of `CtxtCmd`, rather than dealing with them separately at a higher level. I'm not sure about the interactions of having multiple `:m` and `import` commands here, it would be simpler if they were all dealt with together in `playCtxtCmd`. I realise this means changing the types a bit more radically, though. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: igloo Type: feature request | Status: new Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Comment(by simonmar): Oh, one more thing: we should have test cases for the new features, including the tricky cases like multiple imports and combinations of imports and `:m`, and re-loading of source files to trigger the replay functionality. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: igloo Type: feature request | Status: new Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Comment(by SamAnklesaria): Thanks for the comments. `parseName` relies internally on a function from HscMain that does just that: name parsing. I don't think it can handle import declarations, which is why I wrote `hscImport`. As I removed the import from the string the user entered (saving all the import parts in a `remembered_ctx` seems redundant), it needs to be prepended or the parser won't understand it. Importing twice with different import lists is handled like in source files. Any :m commands will overwrite import declarations for the same module. The problem with representing an import in a `CtxCmd` is that it has a completely different syntax, so storing it in the same structure seems awkward. A new patch should be up soon. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: SamAnklesaria Type: feature request | Status: new Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by SamAnklesaria): * owner: = SamAnklesaria -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: high |Milestone: 6.14.1 Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by igloo): * milestone: 6.14 branch = 6.14.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: high |Milestone: 6.14 branch Component: Compiler | Version: 6.8.2 Keywords: ghci, import | Difficulty: Unknown Os: Unknown/Multiple | Testcase: Architecture: Unknown/Multiple | Failure: None/Unknown -+-- Changes (by aavogt): * cc: vogt.a...@… (added) * failure: = None/Unknown -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler ___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: high |Milestone: 6.14 branch Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords: ghci, import | Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * milestone: 6.12.1 = 6.14 branch Comment: Not going to happen for 6.12.1. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords: ghci, import | Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by simonmar): * cc: rt...@science.uva.nl, jcpetru...@gmail.com, gwe...@gmail.com, cgibb...@gmail.com, nicolas.pouill...@gmail.com, ren...@daimi.au.dk, mjm2...@gmail.com (added) Comment: merging with #1895, as this ticket will subsume it. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords: ghci, import | Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by tibbe): * cc: johan.tib...@gmail.com (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords: ghci, import | Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Comment (by simonmar): related: #3217 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: high |Milestone: 6.12.1 Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords: ghci, import | Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by igloo): * priority: normal = high * milestone: 6.10 branch = 6.12.1 Comment: See also #1895 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: normal|Milestone: 6.10 branch Component: Compiler | Version: 6.8.2 Severity: normal| Resolution: Keywords: ghci, import | Difficulty: Unknown Testcase:| Os: Unknown/Multiple Architecture: Unknown/Multiple | -+-- Changes (by thoughtpolice): * cc: mad@gmail.com (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi -+-- Reporter: Isaac Dupree | Owner: Type: feature request | Status: new Priority: normal | Milestone: 6.10 branch Component: Compiler |Version: 6.8.2 Severity: normal | Resolution: Keywords: ghci, import | Difficulty: Unknown Testcase: | Architecture: Multiple Os: Multiple | -+-- Changes (by igloo): * difficulty: = Unknown * milestone: = 6.10 branch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi +--- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: normal |Milestone: Component: Compiler | Version: 6.8.2 Severity: normal | Resolution: Keywords: ghci, import | Testcase: Architecture: Multiple | Os: Multiple +--- Comment (by Isaac Dupree): perhaps somewhat related to #2345 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
[GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi +--- Reporter: Isaac Dupree | Owner: Type: feature request | Status: new Priority: normal | Component: Compiler Version: 6.8.2|Severity: normal Keywords: |Testcase: Architecture: Unknown | Os: Unknown +--- for example, GHCi currently allows `import Data.Map` but not `import Data.Map as Map` or (to demonstrate a fuller range of import syntax) `import qualified Prelude as P hiding (mplus)`. (In GHCi, you'd probably only be interested in hiding/qualifying something like Data.Map that made it harder for you to use Prelude functions due to actual ambiguity -- or vice versa) see http://article.gmane.org/gmane.comp.lang.haskell.cafe/41272 (P.S. I would also like everything in a module, such as `data` declarations, to work in GHCi also, but I suspect that's a more complicated feature request?) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Re: [GHC] #2362: allow full import syntax in GHCi
#2362: allow full import syntax in GHCi +--- Reporter: Isaac Dupree |Owner: Type: feature request | Status: new Priority: normal |Milestone: Component: Compiler | Version: 6.8.2 Severity: normal | Resolution: Keywords: ghci, import | Testcase: Architecture: Multiple | Os: Multiple +--- Changes (by guest): * keywords: = ghci, import * cc: [EMAIL PROTECTED] (added) * os: Unknown = Multiple * architecture: Unknown = Multiple Comment: Currently you can do this using a helper module, which does the required imports. {{{ module Import where import qualified Data.Map as Map }}} {{{ *Prelude :load Import.hs *Import Map.insert ... }}} Of course, doing this in GHCi would be nicer. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2362#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs