[GHC] #11135: Migrate more of Data.Functor.* from transformers to base.

GHC ghc-devs at haskell.org
Tue Dec 15 19:35:47 UTC 2015


#11135: Migrate more of Data.Functor.* from transformers to base.
-------------------------------------+-------------------------------------
        Reporter:  hvr               |                Owner:
            Type:  task              |               Status:  upstream
        Priority:  highest           |            Milestone:  8.0.1
       Component:  libraries/base    |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D1543
       Wiki Page:                    |  Phab:D1544
-------------------------------------+-------------------------------------

Comment (by ross):

 Replying to [comment:8 RyanGlScott]:
 > Ross: I would like to see this change get into GHC 8.0, time permitting.
 >
 > There's one thing that bothers me about the most recent changes to
 `transformers`, however. After
 [http://hub.darcs.net/ross/transformers/patch/55d242cc15cb91c32a28433eff1e928cf113454e
 introducing] `Show1`/`Show2`/et al, you changed the `Show` instances to
 use them. For instance, the `Show` instance for `Backwards`
 [http://hackage.haskell.org/package/transformers-0.4.3.0/docs/src/Control-
 Applicative-Backwards.html#line-49 was]:
 >
 > {{{#!hs
 > instance (Show1 f, Show a) => Show (Backwards f a) where
 >     showsPrec d (Backwards x) = showsUnary1 "Backwards" d x
 > }}}
 >
 > But
 [http://hub.darcs.net/ross/transformers/browse/Control/Applicative/Backwards.hs#57
 now] it's:
 >
 > {{{#!hs
 > instance (Show1 f, Show a) => Show (Backwards f a) where showsPrec =
 showsPrec1
 > }}}
 >
 > The result is that the output of `show` changes. Before, the output of
 `show (Backwards "hello")` would be `"Backwards \"hello\""`, but with the
 latest changes, it's `"Backwards ['h','e','l','l','o']"`! This is because
 the `Show1 []` instance has to be parametric over its argument, so it
 can't tell that `Char` has a special `Show` instance that causes it to be
 shown differently.
 >
 > I feel like we should revert all the `Eq`/`Ord`/`Read`/`Show` instance
 in `transformers` back to the way they were (and keep the
 `Show1`/`Show2`/etc. instances separate) to prevent subtle changes like
 this. Do you agree?

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


More information about the ghc-tickets mailing list