Opened 8 years ago

Closed 8 years ago

Last modified 4 years ago

#880 closed feature request (fixed)

someFunction :: TypeRep -> Int

Reported by: guest Owned by:
Priority: normal Milestone:
Component: libraries/base Version: 6.4.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Easy (less than 1 hour)
Test Case: Blocked By:
Blocking: Related Tickets:

Description (last modified by simonmar)

Now that TypeRep share their keys using RTS internal allocation, can we get a function in Data.Typeable (or even GHC.Exts) that retrieves the Int key? Currently my job code (OpenAFP) and Pugs both uses "show :: TypeRep -> String" as the key for Map, but I think it'd be much, much faster if either TypeRep supports Ord natively, or (preferably) that we can get a Int out of it.

Thanks!
Audrey

Change History (7)

comment:1 Changed 8 years ago by simonmar

  • Description modified (diff)

What do people think here? The options I can think of:

unsafeTypeRepKey :: TypeRep -> Int

Slightly dubious. This behaves like a function in any given run of the program, but does not have a sensible semantics.

typeRepKey :: TypeRep -> IO Int

Less dubious, but perhaps less useful.

comment:2 Changed 8 years ago by guest

I think having it in the IO monad is acceptable; we can unsafePerformIO it when we really want.

Audrey

comment:3 Changed 8 years ago by simonmar

Done.

comment:4 Changed 8 years ago by simonmar

  • Resolution set to fixed
  • Status changed from new to closed

comment:5 Changed 6 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:6 Changed 6 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:7 Changed 4 years ago by simonmar

  • Difficulty changed from Easy (1 hr) to Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.