[GHC] #10311: package name returned from tyConPackage is garbled

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- I am using tyConPackage (etc.) to programmatically generate links to haddock documentation (e.g., from a typed edit widget). This is now broken: {{{ import Data.Map import Data.Typeable tyConPackage $ typeRepTyCon $ typeOf $ fromList [(1,2)] in ghc-7.8.4: "containers-0.5.5.1" in ghc-7.10.1: "conta_47ajk3tbda43DFWyeF3oHQ" }}} and I don't see how to get the actual package name. Cf. http://stackoverflow.com/questions/29638177/tyconpackage-changed-from- ghc-7-8-to-ghc-7-10 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): The reason for this is that the internal representation of TyCons has changed from packagename-version to package keys, which is the garbled output you're seeing. The GHC approved way of getting the original name is to consult the package database. A bit unfortunately, you're not using the GHC API, so I'm not actually sure there is a simple simple way to manage this in your case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): Moreover there is a reason for the change. The `Map` type exposed by `containers-0.5.5.1` compiled against one set of dependencies is not the same as the `Map` type exposed by `containers-0.5.5.1` compiled against a different set of dependencies. The new package keys encode this difference. One mitigation path could be this: perhaps GHC could make it possible to get the package ''name'' from a `TyCon` as well as a package ''key''. See #10068. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by j.waldmann):
... could make it possible to get the package name from a TyCon as well as a package key
That would be very much welcome. Thanks for considering this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by ezyang): * owner: => ezyang -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by j.waldmann): "Moreover there is a reason ..." I understand that but that reason applies to (standalone-)haddock-generated URLs as well. Are you implying that they also should contain the package key (instead of the name)? Of course that would solve my problem as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by ezyang): The issue with Haddock is an interesting one which we have not really adequately discussed yet. I think in principle, Haddock documentation should be placed in a URL `packagename-0.1`, on the principle that the documentation for a package is somehow invariant of what versions you picked for its dependencies. If I want to know what the API of `containers-0.5.6.3` is, I don't care that it was compiled against `base-4.2` or `base-4.3`. But in practice, Haddock documentation (1) must be built with respect to a specific version resolution, and (2) contains links to other packages, the particular versions of which depend on the resolution from (1). So even if I in principle don't care what version of `base` I compiled against, if I click a hyperlink to `Int`, I'm going to have to end up with some version of `base` documentation! But I think this will not solve your problem, because even if Haddock URLs started recording package keys, they would want to record an expanded form, `foo-0.1-47ajk3tbda43DFWyeF3oHQ`. So you will still have to bang on the installed package database to get this from `47ajk3tbda43DFWyeF3oHQ`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Package system | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * component: Compiler => Package system -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Package system | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by j.waldmann): This issue is also surfacing in yesod's logging mechanism (Control.Monad.Logger) which is using `Language.Haskell.TH.Syntax.qLocation`. Very useful, except that it does not quite work for package names. https://github.com/yesodweb/yesod/issues/1236 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Package system | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by snoyberg): Is there a reason why the useful complete package name information was ''removed'' instead of simply augmenting it with the package key as well? This would seem to address all concerns. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Package system | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by j.waldmann): So this was fixed in ghc-8.0.1? By chance I found that the test case from the ticket now does return "containers-0.5.7.1". -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10311: package name returned from tyConPackage is garbled -------------------------------------+------------------------------------- Reporter: j.waldmann | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Package system | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by ezyang): j.waldmann: In a sense. Because of tickets like this, we brought back the long-form version of the Cabal name (so package name plus version). But *technically* the string is still supposed to be opaque and we are still supposed to give you facilities for getting the package name and version. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10311#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC