Generalize types of 'whenJust' and similar functions to return 'Monoid' #150
Labels
feature request
have to think
type:breaking
Breaking change (removal, renaming, semantic change, etc.)
Currently
whenJust
has the following type signature:I propose to generalize types of
whenJust
andwhenJustM
functions to the following:or even following:
()
has trivialMonoid
instance so every existing code will work automatically. Also,IO
hasMonoid
instance.Drawbacks:
Advantages
foldMap :: (Monoid m, Foldable t) => (a -> m) -> t a -> m
behavior forMaybe
.foo <- if p then listDirectory else pure []
shorter. Sometimes onNothing
case we want not onlypure ()
but return somemempty
The text was updated successfully, but these errors were encountered: