Skip to content
  • Simon Peyton Jones's avatar
    [project @ 2001-05-08 14:44:37 by simonpj] · 7c72bad5
    Simon Peyton Jones authored
    ****	MERGE WITH 5.00 BRANCH     ********
    
    	--------------------------------------
    	Make parallel list comprehensions work
    	--------------------------------------
    
    There were two bugs
    
    1.  The desugaring in DsListComp was generating code that failed Lint.
        I've restructured it quite a lot.
    
    2.  More seriously, in a ParStmt, the last 'stmt' may be a guard;
        but previously both guards and the result of a list comprehension
        were encoded as an ExprStmt (see HsExpr.Stmt), using the fact that
        the stmt was last in the list to make the difference between a guard
        and a result.  But in parallel list comp this isn't right:
    
    	[ e | x <- xs, guard | y <- ys ]
    
        Here 'guard' is last in its list, but isn't an overall result.
    
        The sensible fix is to properly distinguish
    	"here's the answer" 			 (ResultStmt)
    	"here's a guard or an imperative action" (ExprStmt)
    
        The fix is rather easy, but touched quite a lot of files.  On the
        way I tidied up the parser a little.
    7c72bad5