The error message is, weirdly, giving a suggestion only valid in ghci. What you actually need to do is `cabal install --lib X11`, and similarly for any other packages it reports.

On Wed, Jul 20, 2022, 11:23 Alain Bertrand <alainbe@free.fr> wrote:
Tried with Cabal.

alain@keitai-kun:~/.config/xmonad$ ~/.cabal/bin/xmonad --recompile
XMonad will use ghc to recompile, because neither
"/home/alain/.config/xmonad/build" nor
"/home/alain/.config/xmonad/stack.yaml
" exists.
XMonad recompiling (forced).
Errors detected while compiling xmonad config:
/home/alain/.config/xmonad/xmonad.hs
$ ghc --make xmonad.hs -i -ilib -fforce-recomp -main-is main -v0
-outputdir /home/alain/.cache/xmonad/build-x86_64-linux -o /ho
me/alain/.cache/xmonad/xmonad-x86_64-linux

xmonad.hs:5:2: error:
    Could not load module ‘Graphics.X11.Xlib’
    It is a member of the hidden package ‘X11-1.10.2’.
    You can run ‘:set -package X11’ 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.
  |
5 |  import Graphics.X11.Xlib
  |  ^^^^^^^^^^^^^^^^^^^^^^^^

Please check the file for errors.

I am ok with ':set -package X11’ but couldn't find the right syntax.


Alain
On 20/07/2022 15:58, Brandon Allbery wrote:
> Oh my. That suggests the corruption is in your main .stack while
> trying to register the built packages. But at this point I have to
> hand you off to someone who knows stack better than I do.