until -package:monad-loops -package:foundation package:extra -is:exact

Keep running an operation until it becomes a Just, then return the value inside the Just as the result of the overall loop.