[ ghc-Bugs-435234 ] nubBy flips args to nubbing function

noreply@sourceforge.net noreply@sourceforge.net
Thu, 21 Jun 2001 14:52:43 -0700


Bugs item #435234, was updated on 2001-06-21 14:52
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=435234&group_id=8032

Category: None
Group: 5.00
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: nubBy flips args to nubbing function

Initial Comment:
The nubBy function in the List library seems to flip
the order of arguments to the nubbing function from
that specified in the prelude:

nubBy eq (x:xs)         =  x : nubBy eq (filter (\y ->
not (eq x y)) xs)

I.e., it seems to use (eq y x) instead of (eq x y). 
This doesn't matter of course for symmetric nubbing
functions, but I just tried to use it with the
following function:

subsetEq :: (Eq a) => [a] -> [a] -> Bool
subsetEq l1 l2 = all (`elem` l2) l1

> nubBy subsetEq [[1],[1,2],[2,3],[2]] 
[[1],[1,2],[2,3]]

> nubBy (flip subsetEq) [[1],[1,2],[2,3],[2]]
[[1],[2,3],[2]]


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=108032&aid=435234&group_id=8032