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

GHC ghc-devs at haskell.org
Mon Jan 7 18:14:44 UTC 2019


#14331: Overzealous free-floating kind check causes deriving clause to be rejected
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.10.1
       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:  15376
 Related Tickets:  #15376            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Visible kind application adds another layer of screwball-ery to the mix:

 {{{#!hs
 {-# LANGUAGE GeneralizedNewtypeDeriving #-}
 {-# LANGUAGE PolyKinds #-}
 {-# LANGUAGE TypeApplications #-}
 module Bug where

 import Data.Kind

 class Cat (cat :: k -> k -> Type)
 instance Cat (->)
 newtype Fun1 a b = Fun1 (a -> b)
   deriving (Cat @k)
 }}}
 {{{
 $ ~/Software/ghc/inplace/bin/ghc-stage2 --interactive Bug.hs -ddump-deriv
 -fprint-explicit-kinds
 GHCi, version 8.7.20190105: https://www.haskell.org/ghc/  :? for help
 Loaded GHCi configuration from /home/rgscott/.ghci
 [1 of 1] Compiling Bug              ( Bug.hs, interpreted )

 ==================== Derived instances ====================
 Derived class instances:
   instance Bug.Cat @* Bug.Fun1 where


 Derived type family instances:


 Ok, one module loaded.
 }}}

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


More information about the ghc-tickets mailing list