Which one makes more sense for you and why?

whenJust :: Applicative f => Maybe a -> (a -> f ()) -> f ()

or

whenJust :: (Applicative f, Monoid m) => Maybe a -> (a -> f m) -> f m

or

whenJust :: Monoid m => Maybe a -> (a -> m) -> m

Follow

@pureevil I like the second one more.

It captures the semantics (I think) you want, while retaining the most flexibility.

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.