
22 Oct
2015
22 Oct
'15
8:27 p.m.
I'm really puzzled by the interface. class Bag b where new :: STM (b v) -- no problem here add :: b v -> v -> STM () -- no problem here isEmpty :: b v -> STM Bool -- no real problem except the pervasive one that whatever -- you learn about the state of a concurrent object must -- always be treated as out of date when you use it take :: b v -> STM v -- what is supposed to happen if the bag is empty? I was expecting an operation like maybeTake :: b v -> STM (Maybe v)