#1360: ghci :load and :add clear module context
----------------------+-----------------------------------------------------
 Reporter:  Frederik  |          Owner:             
     Type:  task      |         Status:  closed     
 Priority:  normal    |      Milestone:  6.10 branch
Component:  GHCi      |        Version:  6.6        
 Severity:  normal    |     Resolution:  fixed      
 Keywords:            |     Difficulty:  Easy (1 hr)
 Testcase:            |   Architecture:  Unknown    
       Os:  Unknown   |  
----------------------+-----------------------------------------------------
Changes (by simonmar):

  * status:  new => closed
  * resolution:  => fixed

Comment:

 I think I've made this work better now:

 {{{
 Fri Nov 16 15:21:48 GMT 2007  Simon Marlow <[EMAIL PROTECTED]>
   * Attempt at fixing #1873, #1360

   I think I figured out a reasonable way to manage the GHCi context,
   comments welcome.

   Rule 1: external package modules in the context are persistent.  That
   is, when you say 'import Data.Maybe' it survives over :load, :add,
   :reload and :cd.

   Rule 2: :load and :add remove all home-package modules from the
   context and add the rightmost target, as a *-module if possible.  This
   is as before, and makes sense for :load because we're starting a new
   program; the old home-package modules don't make sense any more.  For
   :add, it usually does what you want, because the new target will
   become the context.

   Rule 3: any modules from the context that fail to load during a
   :reload are remembered, and re-added to the context at the next
   successful :reload.

   Claus' suggestion about adding the "remembered" modules to the prompt
   prefixed with a ! is implemented but commented out.  I couldn't
   decide whether it was useful or confusing.

   One difference that people might notice is that after a :reload where
   there were errors, GHCi would previously dump you in the most recent
   module that it loaded.  Now it dumps you in whatever subset of the
   current context still makes sense, and in the common case that will
   probably be {Prelude}.
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1360#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to