Definition of emptiness for SampleVar

Simon Hengel simon.hengel at
Mon Nov 8 01:30:37 EST 2010

I'm somewhat confused about the definition of emptiness for SampleVar: A
sample var is /empty/ if it contains no value _and_ if there are no
blocked readers[1].

With this definition, the following program prints `False':

    import Control.Concurrent

    main = do
      var <- newEmptySampleVar

      forkIO $ readSampleVar var

      threadDelay 1000000
      isEmptySampleVar var >>= print

Is this intended behavior? And if yes, what is the rational behind this?

If this is intended behavior, I'd tend to clarify the documentation?
Something like:

    Returns True if the SampleVar is currently empty and if there are no
    readers waiting.

Any thoughts on that?



More information about the Libraries mailing list