[GHC] #13593: Unexpected behavior from Data.List.groupBy
GHC
ghc-devs at haskell.org
Thu Apr 20 06:56:37 UTC 2017
#13593: Unexpected behavior from Data.List.groupBy
-------------------------------------+-------------------------------------
Reporter: dsf | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone:
Component: Core Libraries | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Documentation | Unknown/Multiple
bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by svenpanne):
The Haskell report is very explicit about these functions:
> When the "By" function replaces an Eq context by a binary predicate, the
predicate is assumed to define an equivalence; when the "By" function
replaces an Ord context by abinary predicate, the predicate is assumed to
define a total ordering.
And the `Data.List` documentation repeats these requirements, so I propose
to close this issue as "invalid".
As a side note, I wouldn't call this an "infelicity": If your `Eq`/`Ord`
instances don't obey the required laws, you would have similar fun with
plain `group`. The `By` functions just make an implicit argument explicit,
and I would be very surprised if they behaved differently.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13593#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list