[Haskell-cafe] [Maybe Int] sans Nothings

Henning Thielemann schlepptop at henning-thielemann.de
Mon May 23 22:20:07 CEST 2011


Brent Yorgey schrieb:
> On Mon, May 23, 2011 at 10:49:55AM -0700, Alexander Solla wrote:
>> There's a library function for it, but also:
>>
>>> filter ((/=) Nothing)
>> is readable enough.
> 
> Just a minor quibble: note that
> 
>> filter (not . isNothing)
> 
> is slightly preferable since it does not introduce a frivolous
> equality constraint on the type wrapped by the Maybe.

Similar:
http://www.haskell.org/haskellwiki/Haskell_programming_tips#Reduce_type_class_constraints
http://www.haskell.org/haskellwiki/Haskell_programming_tips#Don.27t_ask_for_the_length_of_a_list_when_you_don.27t_need_it



More information about the Haskell-Cafe mailing list