[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 02:04:20 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
      Resolution:          |             Keywords:
Operating System:  Linux   |         Architecture:  x86_64 (amd64)
 Type of failure:  Other   |            Test Case:
      Blocked By:          |             Blocking:
 Related Tickets:          |  Differential Rev(s):
       Wiki Page:          |
---------------------------+--------------------------------------

Comment (by jol):

 I'm really not sure what the proper fix should be. Because this is meant
 for use by an IDE and not a user, maybe the documentation could simply be
 improved? I spent a while trying to figure out how to use `:type-at`,
 because

 1. I didn't understand that the right bound for the span given should be
 one column to the right of the last character of the expression, and
 2. I didn't know that this would only work when {{{:load}}}-ing with the
 filepath, and not the module name. This was unexpected because the ghc
 user guide entry for `:load` never seems to hint that behaviour could
 depend on which is chosen.
 3. Also, the guide entry for `:type-at` never says that the argument needs
 to be a filepath.

 I think the error messages could also be improved. Point 1 above would've
 been obvious if the error message contained the text it tried to parse,
 after the "not an expression", in between the quotes, instead of just
 presenting an empty string. Also, it's difficult to understand ghci when
 it says that `:type-at` couldn't "guess that module name" when given
 src/Lib.hs in the first session, but it could in the second.

 Anyway, thank you for your attention and the awesome `:type-at` feature.

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


More information about the ghc-tickets mailing list