Standard combinator to get first “non-empty” value from a set of monadic actions
问题 I'm sure I am missing something very obvious here. Here's what I'm trying to achieve at a conceptual level: action1 :: (MonadIO m) => m [a] action1 = pure [] action2 :: (MonadIO m) => m [a] action2 = pure [1, 2, 3] action3 :: (MonadIO m) => m [a] action3 = error "should not get evaluated" someCombinator [action1, action2, action3] == m [1, 2, 3] Does this hypothetical someCombinator exist? I have tried playing round with <|> and msum but couldn't get what I want. I guess, this could be