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)
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe