[GHC] #11028: Refactor ConDecl

GHC ghc-devs at haskell.org
Tue Nov 24 12:34:04 UTC 2015


#11028: Refactor ConDecl
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  alanz
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
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 alanz):

 At the moment `kcConDecl` is defined as

 {{{#!hs
 kcConDecl (ConDecl { con_names = names, con_qvars = ex_tvs
                    , con_cxt = ex_ctxt, con_details = details
                    , con_res = res })
   = addErrCtxt (dataConCtxtName names) $
          -- the 'False' says that the existentials don't have a CUSK, as
 the
          -- concept doesn't really apply here. We just need to bring the
 variables
          -- into scope!
     do { _ <- kcHsTyVarBndrs False ex_tvs $
               do { _ <- tcHsContext ex_ctxt
                  ; mapM_ (tcHsOpenType . getBangType) (hsConDeclArgTys
 details)
                  ; _ <- tcConRes res
                  ; return (panic "kcConDecl", ()) }
        ; return () }
 }}}

 I am working on the `ConDeclGADT` case, and have

 {{{#!hs
 kcConDecl (ConDeclGADT { con_name = name
                        , con_type = HsIB { hsib_kvs = ex_kvs
                                          , hsib_tvs = ex_tvs
                                          , hsib_body = res_ty} })
   = addErrCtxt (dataConCtxtName [name]) $
          -- the 'False' says that the existentials don't have a CUSK, as
 the
          -- concept doesn't really apply here. We just need to bring the
 variables
          -- into scope!
     do { _ <- kcHsTyVarBndrs False ex_tvs $
        .....
        ; return () }
 }}}

 It is not clear to me whether `kcHsTyVarBndrs False ex_tvs` should be
 checking `ex_kvs`, `ex_tvs`, or both. I suspect `ex_kvs` only.

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


More information about the ghc-tickets mailing list