[GHC] #13153: Several Traversable instances have an extra fmap

GHC ghc-devs at haskell.org
Thu Jan 19 23:05:06 UTC 2017


#13153: Several Traversable instances have an extra fmap
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  dfeuer
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Core Libraries    |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 But that's exactly the definition I had in mind. What I was alluding to is
 that you //could// remove the `(<$>)` is the case where the wrapped list
 is empty:

 {{{#!hs
 instance Traversable ZipList where
   traverse (ZipList []) = pure (ZipList [])
 }}}

 But what about this case?

 {{{#!hs
   traverse (ZipList (x:xs)) = ???
 }}}

 I'm not seeing how you can fill in this case without needing to appeal to
 `fmap` or `(<*>)` at some point.

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


More information about the ghc-tickets mailing list