[GHC] #12088: Promote data family instance constructors

GHC ghc-devs at haskell.org
Thu May 19 22:36:27 UTC 2016


#12088: Promote data family instance constructors
-------------------------------------+-------------------------------------
           Reporter:  alexvieth      |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  GHC rejects
  Unknown/Multiple                   |  valid program
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:  #11348
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 In `TcEnv.hs` there is a note AFamDataCon: not promoting data family
 constructors. It states that we can't use a promoted data family instance
 constructor because we would have to interleave the checking of instances
 and data types. But with the fix of #11348, we now do exactly this. In the
 example from the note

 {{{#!hs
 data family T a
 data instance T Int = MkT
 data Proxy (a :: k)
 data S = MkS (Proxy 'MkT)
 }}}

 -ddump-rn-trace shows these groups

 {{{
 rnTycl dependency analysis made groups
  [[data family T a_apG]
  []
  [data instance T Int = MkT],
  [data Proxy (a_apF :: k_apE)]
  []
  [],
  [data S = MkS (Proxy MkT)]
  []
  []]
 }}}

 That's to say, the instance `T Int` will in fact be checked before `S`. So
 let's remove this restriction.

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


More information about the ghc-tickets mailing list