
#10279: panic on haskell-src-exts -------------------------------------+------------------------------------- Reporter: throwaway123 | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Linux | Architecture: x86_64 Type of failure: Compile-time | (amd64) crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): Te basic problem here, which also happened in #, is that `"haskell-src- exts-1.16.0.1"` is not the '''key''' of any package; it's the '''name/version''' of the package. Reminder * The name/version of a package is something like `haskell-src- exts-1.16.0.1`. It represents the source code of a particular released package. * The key of a package is something like `haske_7Ftlz85Zj6I3uisdzq1Sbd`; it represents a compiled instance of the package. Global names (built with `NameG`) contain package keys. Edward Y and I talked. Here's our proposal. 1. Add a new function {{{ reifyPackage :: String -- Package name -> String -- Version -> Q [Package] }}} which, given a package name/version returns all the installed packages with that name and version. The auxiliary types are {{{ data Package = Pkg PkgKey -- Abstract; may grow more fields newtype PkgKey = PkgKey String -- Abstract; packageKey :: Package -> PkgKey -- Accessor packageKey (Pkg p) = p mkPackageKey :: String -> PkgKey mkPackageKey = PkgKey -- Use with caution; these strings are not easy to come up with -- eg "haske_7Ftlz85Zj6I3uisdzq1Sbd" }}} 2. Improve the error message when splicing code that mentions a bad `PkgKey` in a `NameG`, as in comment:8 Notes * A TH `NameG` currently contains a `PkgName`, defined thus: {{{ newtype PkgName = PkgName String -- package name }}} This is badly misleading; we propose to rename it to `PkgKey`, defined above. You can get a `PkgKey` from `reifyPackage` plus `packageKey`; or in some other out-of-band-way plus `mkPkgKey`. * `reifyPackage` returns a list of `Packages`. There can be more than one if the sane package name/version is installed wrt different dependencies; but this is atypical. At some point we may need to support bigger API for `Package`, which lets you get its dependencies. See also #10330. None of this is for 7.10; it's a proposal for 7.12. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10279#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler