Is there an established name for maybe mzero return?
It has the type:
MonadPlus m => Maybe a -> m a
and converts Nothing to failure and Just a to return a.
Is there an established name for maybe mzero return?
It has the type:
MonadPlus m => Maybe a -> m a
and converts Nothing to failure and Just a to return a.
Copyright © 2021 Jogjafile Inc.
optparse-applicativehashoistMaybe.monad-extrashasliftMaybe.errorshasjustZ.IfElsehasmaybeMPAll of the above are the same.
An obvious variant would be
And this is a special case of the following, similar to
asum.The reason you won't find this anywhere is that
pure a <|> x === pure a. So it's good for this and not much else. It could be improved toor
but it's probably clearer just to write it out.