[GHC] #3378: [Patch] Make 'group' into a special ID when TransformListComp is on

GHC trac at galois.com
Fri Jul 17 18:51:08 EDT 2009


#3378: [Patch] Make 'group' into a special ID when TransformListComp is on
-----------------------------+----------------------------------------------
Reporter:  batterseapower    |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  6.10.4            |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 {{{
 -- >>>
 | 'then' exp 'by' exp       { LL $ \leftStmts -> (mkTransformByStmt
 (reverse leftStmts) $2 $4) }
 | 'then' 'group' 'by' exp              { LL $ \leftStmts -> (mkGroupByStmt
 (reverse leftStmts) $4) }
 -- <<<
 -- These two productions deliberately have a shift-reduce conflict. I have
 made 'group' into a special_id,
 -- which means you can enable TransformListComp while still using
 Data.List.group. However, this makes the two
 -- productions ambiguous. I've set things up so that Happy chooses to
 resolve the conflict in that case by
 -- choosing the "group by" variant, which is what we want.
 --
 -- This is rather dubious: the user might be confused as to how to parse
 this statement. However, it is a good
 -- practical choice. NB: Data.List.group :: [a] -> [[a]], so using the
 first production would not even type check
 -- if /that/ is the group function we conflict with.
 }}}

 Take it or leave it :). Probably a win in practice.

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


More information about the Glasgow-haskell-bugs mailing list