Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,260
    • Issues 4,260
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 402
    • Merge Requests 402
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #9241

Closed
Open
Opened Jun 26, 2014 by mhwombat@trac-mhwombat

Add a"same" function to Data.Eq

Add a"same" function to Data.Eq that parallels the "comparing" function in Data.Ord. For example:

-- | 
-- > same p x y = (p x) == (p y)
--
-- Useful combinator for use in conjunction with the @xxxBy@ family
-- of functions from "Data.List", for example:
--
-- >   ... groupBy (same fst) ...
same :: (Eq a) => (b -> a) -> b -> b -> Bool
same p x y = (p x) == (p y)

For a closer parallel, I suppose "same" could return "Equality" (similar to "Ordering"), and the functions "nubBy", "deleteBy", "deleteFirstsBy", "unionBy", "intersectBy" and "groupBy" should take (a -> a -> Equality) (a -> a -> Bool). But I don't know if there's any benefit to that.

Edited Mar 09, 2019 by Herbert Valerio Riedel
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#9241