[GHC] #13593: Unexpected behavior from Data.List.groupBy

GHC ghc-devs at haskell.org
Thu Apr 20 03:44:28 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 dsf):

 I would add:

 It is assumed that the argument function is transitive.  A function like
 `not (a == 1 && b == 1)` will give a result you might not expect:
 {{{#!hs
 > let notBoth1 a b = not (a == 1 && b == 1)
 > groupBy notBoth1  [1,1,2,3,1,1,4,5,6,1]
 [[1],[1,2,3],[1],[1,4,5,6],[1]]
 }}}
 rather than
 {{{#!hs
 [[1],[1,2,3,1],[1,4,5,6,1]]
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13593#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list