As of r10528, the internal STM engine in the Haskell runtime is finally exposed to the userland:
my ($x, $y);
async {
atomically {
$x = $y + 1;
$y = $x + 1;
}
} for 1..5;
say "($x, $y)" # Guaranteed to be (9, 10)
I'd like to thank nothingmuch++ for demanding -- and sponsoring -- this wonderful language feature. See the slides and this paper and another paper for more about STM. More exciting combinators such as orElse, retry and assert coming soon!

Recent Comments