简体   繁体   English

Haskell: TVar: 或者其他

[英]Haskell: TVar: orElse

Is the "else" part of orElse called when a transaction is retried due to another transaction writing to a TVar it had read, or only when retry is explicitly called? orElse的“其他”部分是在由于另一个事务写入它已读取的TVar而重试时调用,还是仅在显式调用retry时调用?

If you have如果你有

orElse ab否则ab

then b is only run if retry is called explicitly in a .那么b仅当在a中显式调用retry时才运行。 Otherwise orElse would essentially become nondeterministic.否则orElse本质上会变得不确定。 (The rerunning of transactions that is done by the STM runtime is transparent and should not effect the outcome of any computation.) (由 STM 运行时重新运行事务是透明的,不应影响任何计算的结果。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM