Opened 11 years ago

Closed 9 years ago

Last modified 8 years ago

#913 closed feature request (wontfix)

instance Ord (StableName a)

Reported by: ekarttun Owned by:
Priority: normal Milestone: 6.10 branch
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:


Being able to have an Ord instance for StableNames would make sense. This would be very useful for code passing around a Set of StableNames. As the Eq instance already exists this would probably not involve any new issues.

Change History (7)

comment:1 Changed 11 years ago by simonmar

Milestone: 6.8

I think this is possible. hashStableName says that it doesn't guarantee to be unique, but I think that's only because StableName identifiers can be reused. There is a danger that one of the SNs might get GC'd just after we call stableNameToInt# on it and the identity could be reused by newStableName in another thread, but the original comparison would still be valid. Conclusion: just call stableNameToInt# on the two stable names and compare the Int#s.

comment:2 Changed 11 years ago by simonmar

From Jan-Willem Maessen:

I feel like I may have already run into this problem with the Eq instance of stableNames. But I was never able to verify for sure that this was going on, and it's rather hard to guarantee that the object referred to by the stable name actually outlives the Int# (if we stick to Haskell code alone).

If I ever get a reproducible bug whose symptoms I understand, I'll let you know. :-) But just to make sure you are aware that this could actually be causing trouble in practice.

comment:3 Changed 10 years ago by simonmar

Milestone: 6.8 branch6.10 branch

comment:4 Changed 9 years ago by igloo

Resolution: wontfix
Status: newclosed

Please follow the library submissions process for this:

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.