Simon Peyton-Jones <[EMAIL PROTECTED]> writes:
 > 
 > | elegant.  If MVar's were instances of Ord as well as Eq, a 
 > | neat solution would
 > | be to always get the least MVar first, but they aren't.  So 
 > | what should one do?
 > 
 > But you could make Flag an instance of Ord
 > 
 >      data Flag = MkFlag Int (MVar Bool)
 > 
 > Now newMVar needs to consult a global variable to get the
 > next Flag number, but after that there's no global locking.
 > 
 > This is, of course, precisely what we'd have to do to make
 > MVars an instance of Ord --- but it would impose a cost on
 > all MVars, whether or not they needed it, which is why we've not
 > done it.
 > 
This is something that I have long been wondering about
(perhaps it is just because of my ignorance):
Wouldn't stable pointers be a cheaper and more appropriate means
to get Ord for MVars, STRefs, and IORefs?


Best regards,

Wolfram

Reply via email to