Using this package describtion
backpack.cabal:
cabal-version: 3.4
name: backpack
version: 0.1.0.0
library
build-depends: backpack:{sig2, impl-s, impl-s2}
default-language: Haskell2010
library sig
signatures:
S
exposed-modules:
T
hs-source-dirs: sig
default-language: Haskell2010
build-depends: base
library sig2
signatures:
S2
hs-source-dirs: sig2
default-language: Haskell2010
build-depends: base, backpack:sig
library impl-s
exposed-modules:
S
hs-source-dirs: impl
build-depends: base
library impl-s2
hs-source-dirs: src
exposed-modules:
S2
build-depends: base, backpack:{sig, impl-s}
impl/S.hs
module S where
type S = Int
sig/S.hsig
signature S where
data S
sig/T.hs
module T where
import S
data T = T { ts1, ts2 :: S}
sig2/S2.hsig
signature S2 where
import T
data S2
s2 :: T -> S2
src/S2.hs
module S2 where
import S
import T
type S2 = (S, S)
s2 :: T -> S2
s2 t = (ts1 t, ts2 t)
When compiling with ghc 9.4.3, ghc reports following error
typecheckIfaceForInstantiate
Declaration for s2:
Can't find interface-file declaration for type constructor or class T
Probable cause: bug in .hi-boot file, or inconsistent .hi file
Use -ddump-if-trace to get an idea of which file caused the error
<no location info>: error:
Cannot continue after interface file error
Error: cabal: Failed to build lib:sig2 from backpack-0.1.0.0 (which is
required by backpack-0.1.0.0).