[GHC] #14645: Allow type family in data family return kind

GHC ghc-devs at haskell.org
Tue Jun 19 15:11:18 UTC 2018


#14645: Allow type family in data family return kind
-------------------------------------+-------------------------------------
        Reporter:  goldfire          |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.4.1-alpha1
      Resolution:                    |             Keywords:  TypeInType,
                                     |  TypeFamilies
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 goldfire):

 For step one, I wonder if it would be better to look for return kinds that
 are not ''apart'' from `TYPE r`. Perhaps this would do it:

 {{{#!hs
 -- | Returns whether the two types are apart. Assumes that
 -- both types have the same kind.
 apart :: Type -> Type -> Bool
 apart ty1 ty2
   | SurelyApart <- tcUnifyTysFG (const BindMe) [ty1] [ty2]
   = True
   | otherwise
   = False
 }}}

 (I'm surprised that function doesn't already exist.)

 Then, use that to check the return kind against `TYPE r` (where `r` can
 really be any tyvar). This should subsume the current check.

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


More information about the ghc-tickets mailing list