Can the definition of alwaysSucceeds be streamlined?

David Feuer david.feuer at
Tue Dec 27 22:29:43 UTC 2016

Currently, `GHC.Conc` has

alwaysSucceeds :: STM a -> STM ()
alwaysSucceeds i = do ( i >> retry ) `orElse` ( return () )
                      checkInv i

If I understand what's going on here (which I may not), I think this
should be equivalent to

alwaysSucceeds i = (i >> retry) `orElse` checkInv i

David Feuer

More information about the ghc-devs mailing list