Say I have some foo :: Maybe Int
and I want to bind it for example with bar :: Int -> MaybeT (Writer String) Int
, what would be the idiomatic way to do that?
I could define my own liftMaybe
function, and then use that, like:
let liftMaybe = maybe (fail "Nothing") return in liftMaybe foo >>= bar
But is there a more idiomatic (or at least concise) way to do that?