#5744: List layouts
---------------------------------+------------------------------------------
    Reporter:  nsch              |       Owner:  nsch            
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  7.2.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonmar):

 Replying to [comment:12 ehird]:

 > My special case was intentional; while the two expressions must have
 equivalent *results*, right-associative use of `mappend` is more efficient
 for basically all `Monoid`s. This is why, e.g. RWH suggests using a
 difference-list rather than `[]` as the monoid of a `Writer`.

 Then it should be a RULE, not part of desugaring.  Otherwise you get
 strange effects like a difference in performance between

 {{{
 mdo { mdo {..}, x }
 }}}
 and
 {{{
 let z = mdo {..} in mdo {z, x}
 }}}

 and I'm not sure I'm comfortable with a built-in bias in the associativity
 of `mappend` - it might be true that most existing Monoids are naturally
 right-associative, but that's not necessarily the case in general.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5744#comment:13>
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