What is a good name for `foo kv m = m >>= kv . return`?

Interesting. What sort of kvs are you using this with? I don’t think I’ve come across the need for this pattern.

If I was using this I’d probably try to write it as an operator on m actions rather than as a higher order function, for example, as

squeezeDry :: Applicative m => m a -> m (m a)
squeezeDry = fmap pure

Then I’d use it as squeezeDry m >>= kv.

4 Likes