Ticket #2836 (new feature request)

Opened 3 years ago

Last modified 4 months ago

Data.Typeable does not use qualified names

Reported by: guest Owned by:
Priority: lowest Milestone: 7.6.1
Component: Compiler Version: 6.10.1
Keywords: Cc: lennart@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonpj) (diff)

The TyCon in Data.Typeable does not provide the qualified type name. This can be very annoying if you try to use a TypeRep as a stored representation of a type (within a run it's OK with the equality on TypeRep).

I suggest that the TyCon be enhanced to contain a qualified name, but that the current API be maintained, except for adding some new functions to access qualified name.

If prodded I could provide the Data.Typeable implementation and the fix to ghc.

Change History

Changed 3 years ago by simonpj

  • difficulty set to Unknown
  • description modified (diff)

Your suggestion sounds plausible to me.

There is some design to do first. Currently Data.Typeable.TyCon is really just a string (plus a key for comparison). Maybe you want three strings?

  • The package name
  • The module name
  • The TyCon name

plus accessor functions.

Another possibility (unavailable when Data.Typeable was designed I think) would be to use a Template Haskell name: Language.Haskell.TH.Syntax.Name. After all, Data.Typeable is just another form of reflection, like TH. I'm not sure what the tradeoffs are though. For example, TH names don't have a key for fast comparison. (But the keys are quite a nuisance in some ways because they may differ from run to run.)

I suggest you progress this via the library process: make proposals, encourage discussion. Actually implementing it will not be hard.

Simon

Changed 3 years ago by simonmar

See also #1841

Changed 3 years ago by igloo

  • milestone set to 6.12 branch

Changed 2 years ago by igloo

  • milestone changed from 6.12 branch to 6.12.3

Changed 2 years ago by igloo

  • priority changed from normal to low
  • milestone changed from 6.12.3 to 6.14.1

Changed 18 months ago by igloo

  • milestone changed from 7.0.1 to 7.0.2

Changed 15 months ago by igloo

  • milestone changed from 7.0.2 to 7.2.1

Changed 8 months ago by igloo

  • milestone changed from 7.2.1 to 7.4.1

Changed 4 months ago by igloo

  • priority changed from low to lowest
  • milestone changed from 7.4.1 to 7.6.1
Note: See TracTickets for help on using tickets.