
#9241: Add a"same" function to Data.Eq ------------------------------------+------------------------------------- Reporter: mhwombat | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Prelude | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9241 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler