Playing with Haskell and now I try to create a function like

```
keepValue :: (Monad m) => m a -> (a -> m b) -> m a

```

with following semantic: it should apply monad value to a function, which return the second monad, and *keep the **result** of the first monad, but the **effect** of the second one*

I have a working function in case of `Maybe` monad:

```
keepValueMaybe :: Maybe a -> (a -> Maybe b) -> Maybe a

keepValue ma f = case ma >>= f of
    Nothing -> Nothing
    Just _ -> ma

```

So if the first value is `Nothing`, the function is not run (so no second side-effect), but if the first value is `Just`, then, the function is run (with side effect). I keep **effect** of the second computation (e.g., `Nothing` makes the whole expression `Nothing`), but the original value.

Now I wonder. Can it work for any monad?

It looks kinda built-in `>>`, but I couldn't find anything in standard library.