Opened 11 years ago

Closed 11 years ago

Last modified 8 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: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

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 11 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 11 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 11 years ago by simonmar

Done.

comment:4 Changed 11 years ago by simonmar

Resolution: fixed
Status: newclosed

comment:5 Changed 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:6 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:7 Changed 8 years ago by simonmar

difficulty: Easy (1 hr)Easy (less than 1 hour)
Note: See TracTickets for help on using tickets.