Skip to content

ghc gives suggestion as though it is ghci

Summary

GHC gives a suggestion that only applies to GHCi.

Steps to reproduce

% cat test17.hs
import Data.Text
% ghc-9.4.2 -hide-package text test17.hs     
[1 of 2] Compiling Main             ( test17.hs, test17.o )

test17.hs:1:1: error:
    Could not load module ‘Data.Text’
    It is a member of the hidden package ‘text-2.0.1’.
    You can run ‘:set -package text’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
1 | import Data.Text
  | ^^^^^^^^^^^^^^^^

Expected behavior

I expected the error message to suggest using -package text, i.e. not mention :set.

Environment

  • GHC version used: 9.4.2 (installed via GHCup)

Originally reported at https://discourse.haskell.org/t/hidden-package-could-not-load-how-to-set/5707

Edited by Tom Ellis
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information