[GHC] #14331: Overzealous free-floating kind check causes deriving clause to be rejected

GHC ghc-devs at haskell.org
Mon Oct 23 08:03:58 UTC 2017


#14331: Overzealous free-floating kind check causes deriving clause to be rejected
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  merge
        Priority:  normal            |            Milestone:  8.2.2
       Component:  Compiler (Type    |              Version:  8.2.1
  checker)                           |
      Resolution:                    |             Keywords:  deriving
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  GHC rejects       |            Test Case:
  valid program                      |  deriving/should_compile/T14331
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 > there can be more unification after part (i) if you are deriving
 Functor, Foldable, or Traversable

 That is terrible!  I had no idea we did this.  It seems absurdly ad-hoc.

 I can see two ways forward.

 1. Require standalone deriving in such cases.  It's not so bad, and is a
 lot clearer!  I'm against inferring too much.  Indeed I'd happily weaken
 our existing inference further.  (Acknowledging back-compat issues.)

 2. Do it properly.  That is, after simplifying the instance constraints
 we'll end up with`k~Type` in these cases, and perhaps others.  Instead of
 rejecting such constraints as too exotic, simply commit to them.  That's
 the "extra unification".

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


More information about the ghc-tickets mailing list