[GHC] #10060: The Traversable instance for Array looks unlikely to be good

GHC ghc-devs at haskell.org
Sun Feb 1 23:37:11 UTC 2015


#10060: The Traversable instance for Array looks unlikely to be good
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |             Owner:  dfeuer
                  Type:  bug         |            Status:  new
              Priority:  normal      |         Milestone:
             Component:  Core        |           Version:  7.11
  Libraries                          |  Operating System:  Unknown/Multiple
              Keywords:              |   Type of failure:  Runtime
          Architecture:              |  performance bug
  Unknown/Multiple                   |        Blocked By:
             Test Case:              |   Related Tickets:
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Currently,
 {{{#!hs
 instance Ix i => Traversable (Array i) where
     traverse f arr = listArray (bounds arr) `fmap` traverse f (elems arr)
 }}}

 Since `traverse` is (inherently) not a good producer for list fusion, this
 looks suspicious. I think we almost certainly want to walk the array by
 hand instead.

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


More information about the ghc-tickets mailing list