[GHC] #8884: Reifying closed type families is broken

GHC ghc-devs at haskell.org
Thu Mar 13 15:08:34 UTC 2014


#8884: Reifying closed type families is broken
------------------------------------+-------------------------------------
       Reporter:  goldfire          |             Owner:  goldfire
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:  7.8.1
      Component:  Template Haskell  |           Version:  7.8.1-rc2
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 If I say

 {{{
 {-# LANGUAGE TemplateHaskell, TypeFamilies, PolyKinds #-}

 module Scratch where

 import Language.Haskell.TH

 type family Foo a where
   Foo x = x

 $( do FamilyI foo [] <- reify ''Foo
       runIO $ putStrLn $ show foo
       return [] )
 }}}

 and compile, I see (with uniques suppressed)

 {{{
 ClosedTypeFamilyD Scratch.Foo
   [KindedTV a (VarT k)]
   (Just (AppT (AppT ArrowT (VarT k)) (VarT k)))
   [TySynEqn [VarT k,VarT x] (VarT x)]
 }}}

 There are two problems here:

 1. The return kind (the third parameter to `ClosedTypeFamilyD`) should be
 just that -- the return kind. In the output, we see the full kind of the
 type family. `k -> k`.

 2. The equation includes the kind variable `k`, which should be implicit.

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


More information about the ghc-tickets mailing list