
17 Feb
2010
17 Feb
'10
9:56 a.m.
2010/2/17 Neil Brown
You don't need to do use ThreadId: MVar has an Eq instance, so you could make your Lock type derive an Eq instance, and then you can just compare the Locks to remove it after the timeout occurs (e.g. using delete to take it out of the list; it should be quite near the head of the list anyway). In fact, you may as well make most of your types derive an Eq instance where possible, as this can be useful sometimes.
Now I am wondering why I didn't think of that before. It's an elegant solution. Thanks!