when package:rec-def

An kind of if-then-else statement. Because of monotonicity requirements, this should be sufficient.
RS.get (RS.when b r) === (if RB.get b then RS.get r else S.empty)
whenTop p act runs act if p is already top, or after setTop p is run