Libraries Digest, Vol 117, Issue 10
Felipe Almeida Lessa
felipe.lessa at gmail.com
Fri May 10 21:30:07 CEST 2013
IMNSHO, I think we should just add
-- | @whenJust = 'for_'@. Executes the given action
-- when @Just@, execute nothing if @Nothing at .
whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust = for_
to Data.Maybe. Even if it's duplicating a functionality, it's a good
name that has been reinvented by many people. Its docs may mention
for_ and teach the user that for_ is more generic etc. People looking
for whenJust *will* look at Data.Maybe. We don't lose much by adding
this function.
On Fri, May 10, 2013 at 4:00 PM, Gwern Branwen <gwern at gwern.net> wrote:
> On Fri, May 10, 2013 at 2:54 PM, Chris Seaton <chris at chrisseaton.com> wrote:
>> Perhaps we should have a dummy module in Hackage that includes commonly
>> searched for functions, but instead of actually implementing them the
>> documentation would say don't use this and suggest an alternative and
>> explains why. Then you could find them in Hoogle and Hackage seems to be
>> highly ranked on Google so they'd be found there as well.
>
> Or expand hlint to catch whenJust like constructs and suggest use of
> the alternative? We already did that for when 'void' was added, put in
> a suggestion looking for things like '>> return ()'
>
> --
> gwern
> http://www.gwern.net
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
--
Felipe.
More information about the Libraries
mailing list