[GHC] #11732: Deriving Generic1 interacts poorly with TypeInType

GHC ghc-devs at haskell.org
Sun Mar 27 14:46:07 UTC 2016


#11732: Deriving Generic1 interacts poorly with TypeInType
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:  TypeInType,
                                     |  Generics
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Interesting, you'd be alright with the second option? I like that idea
 since it requires //zero// instantiation checks, but you did object to it
 earlier:

 > I claim that
 >
 > {{{
 > data Proxy k (a :: k) = ProxyCon deriving Generic1
 > }}}
 >
 > should fail outright. I don't think GHC should be in the business of
 inferring values for visible parameters like `k`, even when it could.
 Instead, it should be this:
 >
 > {{{
 > deriving instance Generic1 (Proxy *)
 > }}}
 >
 > Note that this applies to `Functor` as much as it does to `Generic1`.

 ...

 > But
 >
 > {{{
 > data Proxy k (a :: k) deriving Functor
 > }}}
 >
 > would try instance `Functor (Proxy k)`, which is ill-kinded. GHC is
 surely clever enough to figure out that it should really do instance
 `Functor (Proxy *)`, but I think it should refrain from doing this.

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


More information about the ghc-tickets mailing list