until -package:clash-prelude -package:utility-ht package:selective

Keep running an effectful computation until it returns a Right value, collecting the Left's using a supplied Monoid instance.