[GHC] #7842: Incorrect checking of let-bindings in recursive do

GHC cvs-ghc at haskell.org
Tue May 7 03:19:20 CEST 2013


#7842: Incorrect checking of let-bindings in recursive do
--------------------------------------+-------------------------------------
Reporter:  diatchki                   |          Owner:                         
    Type:  bug                        |         Status:  new                    
Priority:  normal                     |      Component:  Compiler (Type checker)
 Version:  7.7                        |       Keywords:                         
      Os:  Unknown/Multiple           |   Architecture:  Unknown/Multiple       
 Failure:  GHC rejects valid program  |      Blockedby:                         
Blocking:                             |        Related:                         
--------------------------------------+-------------------------------------

Comment(by parcs):

 Another test case:

 {{{
 bug :: IO (Char,Bool)
 bug = mdo
    a <- return b
    let f = id
    b <- return a
    return (f 'a', f True)
 }}}

 which gets renamed to:

 {{{
 finish rnSrc bug :: IO (Char, Bool)
              bug
                = mdo { rec { a <- return b;
                              let f = id; -- 'f' can be placed outside the
 recursive block
                              b <- return a };
                        return (f 'a', f True) }
 }}}

 Possible solution: At the moment, all statements are kept in order during
 segment glomming (`RnExpr.glomSegments`) but that seems overly
 restrictive. Let-statements inside an `mdo` block should be able to get
 rearranged during segment glomming so that they can possibly be placed
 outside a recursive segment.

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



More information about the ghc-tickets mailing list