#2440: Bad code with type families
-----------------------------------------+----------------------------------
    Reporter:  rl                        |        Owner:                  
        Type:  run-time performance bug  |       Status:  new             
    Priority:  normal                    |    Milestone:  6.10 branch     
   Component:  Compiler                  |      Version:  6.9             
    Severity:  normal                    |   Resolution:                  
    Keywords:                            |   Difficulty:  Unknown         
    Testcase:                            |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple          |  
-----------------------------------------+----------------------------------
Comment (by batterseapower):

 (Repost for formatting reasons...)

 Is there some reason the coercion for this case is so complicated? It
 seems to me (with my admittedly limited knowledge of type coercions) that
 we could improve it to:

 {{{
 (trans (sym (GHC.ST.NTCo:ST s GHC.Types.Int))
        ((sym (Foo.TFCo:R1:M s)) GHC.Types.Int))
   :: STRep s Int ~ M (Vec s) Int
 }}}

 Here I have used the rewrite rules:

 {{{
 trans (x :: a ~ a) (x :: a ~ a) ==> x
 sym (x :: a ~ a) ==> x
 trans x (y :: a ~ a) ==> x
 }}}

 And optionally you could also do:

 {{{
 trans (sym x) (sym y) ==> sym (trans x y)
 }}}

 I don't think this helps fixing this bug at all, but it seemed a bit fishy
 to me, and doing this improvement would at least help readability of Core.
 Am I way off base here?

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