MVar/Chan Ord instance

Mitar mmitar at gmail.com
Wed Jan 5 13:16:24 CET 2011


Hi!

Is it possible to derive Ord for MVar (and based on that also for
Chan)? Currently Eq is defined as reference equality (so each MVar is
different from each other, independently from the content), at least
as I understand it. But it would be useful to have also Ord defined in
a such way (Ord of references). So without any semantic meaning of
this ordering, but so that MVars (and Chans) can be used in set data
types so that it is possible to define O(log n) isMember operation.

I see that Eq is defined with internal function sameMVar#, so probably
there would be also ordMVar# needed for this? Is there a way to get
MVar internal references somehow (so that what sameMVar# is using)?


Mitar



More information about the Glasgow-haskell-users mailing list