
Hi cafe, I'm currently writing GHC Type-Checker Plugin [ghc-typelits-presburger], which enhances type-inference involving type-level naturals using Presburger arithmetic. To process constraints properly, I need an access to TyCons of `TrueSym0`, `FalseSym0`, `GTSym0`, etc. from `singletons` package. These types are exposed by public modules, e.g. Data.Singletons.Prelude, but it seems that they are originally defined in private module `Data.Singletons.Prelude.Instances`. I first tried, to retrieve the `TyCon` for `TrueSym0`, the following: ``` insts <- lookupModule (mkModuleName "Data.Singletons.Prelude.Instances") (fsLit "singletons") singTrueSym0 <- tcLookupTyCon =<< lookupOrig insts (mkTcOcc "TrueSym0") ``` But this results in the following compile-time error: ``` ghc: panic! (the 'impossible' happened) (GHC version 8.6.5 for x86_64-apple-darwin): Unable to resolve module looked up by plugin: Data.Singletons.Prelude.Instances Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug ``` Then, I tried to lookup `TrueSym0` from exposed module, say Data.Singletons.Prelude: ``` prel <- lookupModule (mkModuleName "Data.Singletons.Prelude") (fsLit "singletons") singTrueSym0 <- tcLookupTyCon =<< lookupOrig prel (mkTcOcc "TrueSym0") ``` But this resulted in the following error: ``` • Can't find interface-file declaration for type constructor or class singletons-2.5.1:Data.Singletons.Prelude.TrueSym0 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 • In the type signature: ... ``` Is there any way, in GHC API, to lookup symbols exported from public module but originally defined in hidden module? Thanks, [ghc-typelits-presburger]: https://github.com/konn/ghc-typelits-presburger -- Hiromi ISHII konn.jinro@gmail.com