[Haskell-cafe] readEitherChan

Simon Marlow simonmar at microsoft.com
Mon Jun 28 08:05:48 EDT 2004

On 25 June 2004 21:20, S. Alexander Jacobson wrote:

> On Fri, 25 Jun 2004, Simon Marlow wrote:
>> It seems to me that with MVars you can implement pretty much any
>> abstraction you need, including choice, and it's not clear that there
>> would be any advantage to providing any more primitives.  That's
>> based on my experience so far, anyway - I know there are people out
>> there that have made rather more heavy use of MVars than I have (eg.
>> George Russell).
> Well we appear to be having a problem implementing
> a takeEitherMVar or readEitherChan without adding
> a new abstraction....

I strongly suspect that it can't be done, at least not if you want to
have (a) non-busy waiting, and (b) async exception safety.

My point was that I believe in order to support takeEitherMVar as a
primitive, we would have to add essentially the same machinery to MVars
that you would need if you were to implement it as an abstraction on top
of MVars in Haskell.


More information about the Haskell-Cafe mailing list