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

GHC ghc-devs at haskell.org
Mon Dec 21 03:46:16 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 Phab:D1630
-------------------------------------+-------------------------------------

Comment (by ekmett):

 @duairc:

 The benefit of having `Eq1`, `Ord1`, etc. in the first place is that the
 resulting instances are fully Haskell 98 and do not require language
 extensions at all.

 {{{#!hs
 instance Eq (f (g a)) => Eq (Compose f g a)
 }}}

 requires `FlexibleContexts`.

 This means that `transformers` which works on *every* compiler since
 Haskell 98 _without any CPP_ simply could not accept instances of this
 form.

 Even allowing for that, it is beneficial to allow things like

 {{{#!hs
 instance (Eq1 f, Eq1 g) => Eq1 (Compose f g)
 }}}

 because instances like that are more useful in the presence of polymorphic
 recursion than the at-first-glance simpler pointwise `Eq` instance,
 because it says something fundamental about how the instances are defined:
 that it isn't able to do something hinky with the argument type, and do
 something fundamentally different for `Compose Foo [] Int` vs. `Compose
 Foo [] Double`, that both have to use the `Eq` or `Ord` or `Read` or
 `Show` instance for 'Int' or `Double` in a homogeneous way, not separate
 `FlexibleInstances`. This is confidence you do not get from the pointwise
 definitions.

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


More information about the ghc-tickets mailing list