[GHC] #14529: Refactor ConDecl

GHC ghc-devs at haskell.org
Mon Nov 27 13:35:49 UTC 2017


#14529: Refactor ConDecl
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1
      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 simonpj):

 Here's what I have
 {{{
 data ConDecl pass
   = ConDeclGADT
       { con_names   :: [Located (IdP pass)]

       -- The next four fields describe the type after the '::'
       -- See Note [GADT abstract syntax]
       , con_forall  :: Bool                    -- ^ True <=> explicit
 forall
                                                -- False => hsq_explicit is
 empty
       , con_qvars   :: LHsQTyVars pass
       , con_mb_cxt  :: Maybe (LHsContext pass) -- ^ User-written context
 (if any)
       , con_args    :: HsConDeclDetails pass   -- ^ Arguments; never
 InfixCon
       , con_res_ty  :: LHsType pass            -- ^ Result type

       , con_doc     :: Maybe LHsDocString
           -- ^ A possible Haddock comment.
       }

   | ConDeclH98
       { con_name    :: Located (IdP pass)

       , con_forall  :: Bool   -- ^ True <=> explicit user-written forall
                               --     e.g. data T a = forall b. MkT b
 (b->a)
                               --     con_qvars = {b}
                               -- False => hsq_implicit, hsq_explicit both
 empty
       , con_qvars   :: LHsQTyVars pass    -- Existentials only

       , con_mb_cxt :: Maybe (LHsContext pass)
          -- ^ User-written context (if any)

       , con_args   :: HsConDeclDetails pass
           -- ^ Arguments

       , con_doc       :: Maybe LHsDocString
           -- ^ A possible Haddock comment.
       }
 }}}
 `LHsQTYVars` seems right to me.  I need those implicit binders.  But not,
 I grant you, in the H98 case, because we never bind implicit variables
 there. I can change that too.

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


More information about the ghc-tickets mailing list