[GHC] #5609: Type checking arrow notation in the presence of deferred constraints

GHC cvs-ghc at haskell.org
Mon Mar 4 10:43:32 CET 2013


#5609: Type checking arrow notation in the presence of deferred constraints
----------------------------------------+-----------------------------------
    Reporter:  dreixel                  |       Owner:  ross            
        Type:  bug                      |      Status:  new             
    Priority:  low                      |   Milestone:  7.6.2           
   Component:  Compiler (Type checker)  |     Version:  7.3             
    Keywords:                           |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple         |     Failure:  None/Unknown    
  Difficulty:                           |    Testcase:                  
   Blockedby:                           |    Blocking:                  
----------------------------------------+-----------------------------------

Comment(by simonpj@…):

 commit c3ad38d7dc39ef583ddfb586413baa2e57ca3ee8
 {{{
 Author: Simon Peyton Jones <simonpj at microsoft.com>
 Date:   Mon Mar 4 09:40:56 2013 +0000

     Rearrange the typechecking of arrows, especially arrow "forms"

     The typechecking of arrow forms (in GHC 7.6) is known to be bogus, as
     described in Trac #5609, because it marches down tuple types that may
     not yet be fully worked out, depending on when constraint solving
     happens.  Moreover, coercions are generated and simply discarded.  The
     fact that it works at all is a miracle.

     This refactoring is based on a conversation with Ross, where we
     rearranged the typing of the argument stack, so that the arrows
     have the form
        a (env, (arg1, (arg2, ...(argn, ())))) res
     rather than
        a (arg1, (arg2, ...(argn, env))) res
     as it was before.

     This is vastly simpler to typecheck; just look at the beautiful,
     simple type checking of arrow forms now!

     We need a new HsCmdCast to capture the coercions generated from
     the argument stack.

     This leaves us in a better position to tackle the open arrow tickets
      * Trac #5777 still fails.  (I was hoping this patch would cure it.)
      * Trac #5609 is too complicated for me to grok.  Ross?
      * Trac #344
      * Trac #5333

  compiler/deSugar/Coverage.lhs     |    3 +
  compiler/deSugar/DsArrows.lhs     |  486
 +++++++++++++++++++++----------------
  compiler/hsSyn/HsExpr.lhs         |   13 +-
  compiler/hsSyn/HsUtils.lhs        |    7 +-
  compiler/parser/Parser.y.pp       |    4 +-
  compiler/parser/RdrHsSyn.lhs      |    4 +-
  compiler/rename/RnExpr.lhs        |    4 +-
  compiler/rename/RnTypes.lhs       |    2 +-
  compiler/typecheck/TcArrows.lhs   |  272 ++++++++++-----------
  compiler/typecheck/TcHsSyn.lhs    |    6 +-
  docs/users_guide/glasgow_exts.xml |   48 +++--
  11 files changed, 461 insertions(+), 388 deletions(-)
 }}}

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



More information about the ghc-tickets mailing list