Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,261
    • Issues 5,261
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 565
    • Merge requests 565
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #557
Closed
Open
Issue created Jun 21, 2001 by nobody@trac-nobody

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking