Proposal: replace readMVar with atomicReadMVar, breaking BC

Milan Straka fox at
Wed Jul 10 21:46:10 CEST 2013

> -----Original message-----
> From: "Edward Z. Yang" <ezyang at MIT.EDU>
> Sent: 10 Jul 2013, 02:20
> GHC HEAD recently got a new primitive: atomicReadMVar#, which allows you
> to read MVars without first taking and then putting back (removing a
> nasty race where readMVar only works properly when there are no waiting
> putters).

That is great, I have been missing such a primitive.

> The general feeling Simon and I have is that everyone really wanted
> to make believe readMVar was atomicReadMVar, and so maybe we should
> break BC and make readMVar do the right thing.  But it is probably
> worth some discussion, and I entreat you to think about the second
> point more carefully.

+1 from me. Even though it is a BC and a change in semantics, it is
a change to the behaviour people expect or hope for when using readMVar.


More information about the Libraries mailing list