#4430: Better support for resolving infix expressions in template haskell
---------------------------------+------------------------------------------
    Reporter:  reinerp           |        Owner:  igloo       
        Type:  feature request   |       Status:  patch       
    Priority:  normal            |    Milestone:  7.4.1       
   Component:  Template Haskell  |      Version:  6.12.3      
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by simonpj):

 Re bullet 3, I see now.  (Please put that in the big comment, or whatever
 we agree.)

 Perhaps we should just say that
 {{{
 InfixE Nothing plus (UInfixE 1 plus 2)           ----->  (+ (1 + 2))
 }}}
 There is only one (legal) meaning for what the data structre represents,
 so let's just pick that.  That's what I thought the idea was, and it's why
 I was confused.  Why generate a possibly bogus term if there's an obvious
 legal meaning?

 After all we have that
 {{{
 InfixE 0 * (UInfixE 1 + 2)           ----->  (0 * (1 + 2))
 }}}
 (that is, we parenthesise the arguments of `InfixE` regardless of their
 form) so it seems entirely consistent for sections too.

 Re last bullet:
  * I think it would be worth documenting the left-biased form that GHC's
 renamer expects.  There is a bit in `RnTypes.lhs` line 280 or so, but it
 lacks a `Note [blah]` heading -- you could add that and expand the note.
  * I was thinking of a comment to say "this is why `cvtOpAppP` has to
 reassociate the tree.  Documenting the implementation (to convince oneself
 that it does indeed do so) is a separate matter.  Your comment on that
 looks fine; except we need to know that the return value of `cvtl`
 satisfies the invariant, since that supplies the initial arg to
 `cvtOpAppP`.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to