[GHC] #14374: group by using groupWith seems stricter than it need be

GHC ghc-devs at haskell.org
Thu Oct 19 18:08:27 UTC 2017


#14374: group by using groupWith seems stricter than it need be
-------------------------------------+-------------------------------------
           Reporter:  newthin        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Using TransformListComps:

 {{{#!hs
 is = [1..10]
 fs = map ((,) False) is
 ts = map ((,) True ) is

 a = [(the b, take 5 n) | (b,n) <- ts ++ fs, then group by b using
 groupWith]
 b = [(the b, take 5 n) | (b,n) <- ts ++ fs ++ [undefined], then group by b
 using groupWith]
 c = take 2 b
 }}}

 As of GHC 8.2.1, both b and c fail.

 While getting b to work seems difficult - it would require realizing that
 the domain of Bool has been satisfied - c seems like it might be more
 feasible to get working.

 As a motivator, this pattern is pretty common in data science, where we
 want to map elements of a large list to a small result domain and get
 examples of those elements with each result without iterating through the
 whole list.

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


More information about the ghc-tickets mailing list