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

GHC ghc-devs at haskell.org
Mon Dec 21 01:37:09 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 duairc):

 While I can see how the `Eq1`, `Ord1`, `Read1` and `Show1` classes could
 be useful in their own right, is it set in stone that the `Eq`, `Ord`,
 `Read` and `Show` instances of the various functors must use them? Why
 can't the `Eq` instance for `Compose` just be `Eq (f (g a)) => Eq (Compose
 f g a)`? Do we care about Haskell98 compatibility in `base`?

 I don't have a strong opinion either way for `Eq`, `Ord`, `Read` and
 `Show`, but I would slightly prefer instances of the form I have above.
 What I'm really interested in is the other type classes for which the
 functors could have instances. Do we need to make a `Semigroup1`, a
 `Monoid1` if we want to make `Compose` an instance of `Semigroup` and
 `Monoid`? What about a `Storable1`? Or can we just make an instance
 `Storable (f (g a)) => Eq (Compose f g a)`?

 I would basically like to make as many of these instances as possible,
 because I'm working on something at the moment that uses a lot of functors
 and potentially compositions of functors, but I want to "keep" as many of
 the instances of my base types as possible.

 I'd be happy to do up a patch that made as many of these instances as
 possible, but I'm wondering would I be expected to make all those extra
 classes, or could I just make the non-Haskell98 instances? And if so, is
 there any good reason not to just do the same for `Eq`, `Ord`, `Read` and
 `Show`?

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


More information about the ghc-tickets mailing list