[GHC] #14780: :type-at doesn't work when :load-ing with module name instead of file path

GHC ghc-devs at haskell.org
Fri Feb 9 01:32:45 UTC 2018


#14780: :type-at doesn't work when :load-ing with module name instead of file path
--------------------------------------+---------------------------
           Reporter:  jol             |             Owner:  (none)
               Type:  bug             |            Status:  new
           Priority:  normal          |         Milestone:
          Component:  GHCi            |           Version:  8.2.2
           Keywords:                  |  Operating System:  Linux
       Architecture:  x86_64 (amd64)  |   Type of failure:  Other
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------
 After running

 {{{#!sh
 stack new something
 cd something
 }}}

 we have a file in src/Lib.hs with the contents:

 {{{#!hs
 module Lib
     ( someFunc
     ) where

 someFunc :: IO ()
 someFunc = putStrLn "someFunc"
 }}}

 If we start `stack ghci`, we can have the following session showing the
 errors:

 {{{
 > :set +c
 > :l Lib
 [1 of 1] Compiling Lib              ( /home/jol/work-
 for/me/something/src/Lib.hs, interpreted )
 Ok, one module loaded.
 Collecting type info for 1 module(s) ...
 > :type-at Lib 6 12 6 20

 <no location info>: error: not an expression: ‘’
 > :type-at src/Lib.hs 6 12 6 20
 Couldn't guess that module name. Does it exist?
 }}}

 If we had done `:l src/Lib.hs` instead, then we can use the filepath like
 the following, but still not the module name:

 {{{
 > :set +c
 > :l src/Lib.hs
 [1 of 1] Compiling Lib              ( src/Lib.hs, interpreted )
 Ok, one module loaded.
 Collecting type info for 1 module(s) ...
 > :type-at Lib 6 12 6 20

 <no location info>: error: not an expression: ‘’
 > :type-at src/Lib.hs 6 12 6 20
  :: String -> IO ()
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14780>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list