There is an issue on Stack’s repository that has me stumped, so I am putting it to a wider audience. Any advice, gratefully received. I’ve not spotted anything in the GHC 9.6.1/9.6.2 or Cabal 3.10.1.0 change logs that seems to go to the following.
A single-package project has src/A.hs
:
{-# LANGUAGE DataKinds #-}
module A where
import Polysemy
import Polysemy.State
import Prelude
f :: Sem '[State Int] ()
f = pure ()
and Cabal file:
cabal-version: 1.12
name: problematic
version: 0.0.0.0
build-type: Simple
library
exposed-modules: A
hs-source-dirs: src
ghc-options: -fplugin=Polysemy.Plugin
build-depends:
base
, polysemy
, polysemy-plugin
default-language: Haskell2010
With GHC 9.4.7/Cabal 3.8.1.0 it builds: stack --resolver lts-21.12 build
.
Simply switching to GHC 9.6.2/Cabal 3.10.1.0 it fails (stack --resolver nightly-2023-09-22 build
), at the point that Cabal (the tool) tries to register the library with GHC. The error is (with --ghc-options -v
, for extra GHC information):
problematic> copy/register
Installing library in C:\Users\mpilgre\Documents\Code\Haskell\psymy\.stack-work\install\834933cc\lib\x86_64-windows-ghc-9.6.2\problematic-0.0.0.0-DvlZTrIQMfKBSnzzdqzDM
Error: Cabal-simple_9p6GVs8J_3.10.1.0_ghc-9.6.2.exe:
'C:\Users\mpilgre\AppData\Local\Programs\stack\x86_64-windows\ghc-9.6.2\bin\ghc-9.6.2.exe'
exited with an error:
Glasgow Haskell Compiler, Version 9.6.2, stage 2 booted by GHC version 9.4.3
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
<command line>: Could not find module `Polysemy.Plugin'
Locations searched:
.stack-work\dist\01de9cfc\build\Polysemy\Plugin.hi
.stack-work\dist\01de9cfc\build\Polysemy\Plugin.hi-boot
Why GHC 9.6.2 (and, I assume, not GHC 9.4.7) is looking in .stack-work
(and only there) is a mystery to me. ghc-pkg 9.6.2
in the Stack environment, for example, knows that Polysemy.Plugin
is to be found in the snapshot (extracts):
> stack --resolver nightly-2023-09-22 exec -- ghc-pkg find-module Polysemy.Plugin
C:\Users\mpilgre\AppData\Local\Programs\stack\x86_64-windows\ghc-9.6.2\lib\package.conf.d
(no packages)
C:\sr\snapshots\3a7b44d0\pkgdb
polysemy-plugin-0.4.5.1
C:\Users\mpilgre\Documents\Code\Haskell\psymy\.stack-work\install\834933cc\pkgdb
(no packages)