#2400: location-dependent scope issue with ghci.conf
------------------------+---------------------------------------------------
    Reporter:  claus    |       Owner:         
        Type:  bug      |      Status:  new    
    Priority:  normal   |   Component:  GHCi   
     Version:  6.9      |    Severity:  normal 
    Keywords:           |    Testcase:         
Architecture:  Unknown  |          Os:  Windows
------------------------+---------------------------------------------------
 I recently noticed some of my `ghci.conf` commands going wrong in newer
 GHCis, and have now reduced the issue to this tiny example, which ceases
 to work when moved from a locally sourced script to the main `ghci.conf`
 location:
 {{{
 $ cat $HOME/.ghci
 cat: /home/cr3/.ghci: No such file or directory

 $ cat ./.ghci
 cat: ./.ghci: No such file or directory

 $ cat /cygdrive/c/Documents\ and\ Settings/cr3/Application\
 Data/ghc/ghci.conf
 let { msg () = "done" ; grep _ = return $ unlines ["let x=()","putStrLn
 (msg x)"] }

 :def grep grep


 $ cat U.hs


 $ /cygdrive/c/ghc/ghc-6.9.20080514/bin/ghcii.sh U.hs
 GHCi, version 6.9.20080514: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling Main             ( U.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> :grep x

 <interactive>:1:10: Not in scope: `msg'
 *Main> msg ()

 <interactive>:1:0: Not in scope: `msg'
 *Main> :q
 Leaving GHCi.

 $ cp /cygdrive/c/Documents\ and\ Settings/cr3/Application\
 Data/ghc/ghci.conf .

 $ cat ghci.conf
 let { msg () = "done" ; grep _ = return $ unlines ["let x=()","putStrLn
 (msg x)"] }

 :def grep grep


 $ /cygdrive/c/ghc/ghc-6.9.20080514/bin/ghcii.sh U.hs -ignore-dot-ghci
 GHCi, version 6.9.20080514: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer ... linking ... done.
 Loading package base ... linking ... done.
 [1 of 1] Compiling Main             ( U.hs, interpreted )
 Ok, modules loaded: Main.
 *Main> :grep
 unknown command ':grep'
 use :? for help.
 *Main> :cmd readFile "ghci.conf"
 *Main> :grep x
 done
 *Main> msg ()
 "done"
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2400>
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