Skip to content

:type-at doesn't work when :load-ing with module name instead of file path

After running

stack new something
cd something

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

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 ()
Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component GHCi
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information