nubBy flips args to nubbing function
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]]
Trac metadata
Trac field |
Value |
Version |
5.0 |
Type |
Bug |
TypeOfFailure |
OtherFailure |
Priority |
normal |
Resolution |
ResolvedRemind |
Component |
None |
Test case |
|
Differential revisions |
|
BlockedBy |
|
Related |
|
Blocking |
|
CC |
|
Operating system |
|
Architecture |
|