[GHC] #7611: Rewrite rules application prevented by type variable application (map id vs. map (\x -> x))

#7611: Rewrite rules application prevented by type variable application (map id vs. map (\x -> x)) -----------------------------+---------------------------------------------- Reporter: nomeata | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- I’m moving the discussion from http://www.haskell.org/pipermail/glasgow-haskell- users/2013-January/023522.html (with reply at http://www.haskell.org/pipermail/glasgow-haskell- users/2013-January/023531.html) here, as a reminder for myself to work on it someday: Short summary: a rule "map (\x -> x) = id" will not match "map id" because the latter has (in Core) an application of a type variable, despite the matcher looking through the definition of id. Doing beta-reduction (of type applications) in the matcher could fix this. I’ll attach a test case. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7611 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7611: Rewrite rules application prevented by type variable application (map id vs. map (\x -> x)) -----------------------------+---------------------------------------------- Reporter: nomeata | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Comment(by nomeata): Test case attached; you can also conveniently pull it via {{{ git pull git://git.nomeata.de/ghc-testsuite.git T7611 }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7611#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7611: Rewrite rules application prevented by type variable application (map id vs. map (\x -> x)) -----------------------------+---------------------------------------------- Reporter: nomeata | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Changes (by PHO): * cc: pho@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7611#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7611: Rewrite rules application prevented by type variable application (map id vs. map (\x -> x)) -----------------------------+---------------------------------------------- Reporter: nomeata | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.1 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: None/Unknown | Blockedby: Blocking: | Related: -----------------------------+---------------------------------------------- Changes (by liyang): * cc: hackage.haskell.org@… (added) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7611#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7611: Rewrite rules application prevented by type variable application (map id vs. map (\x -> x)) ------------------------------------+--------------------------------------- Reporter: nomeata | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: Os: Unknown/Multiple | Architecture: Unknown/Multiple Failure: Runtime performance bug | Blockedby: Blocking: | Related: ------------------------------------+--------------------------------------- Changes (by liyang): * failure: None/Unknown => Runtime performance bug * version: 7.6.1 => 7.6.2 Comment: I think this may be related, but in this case I can't see what rule I could possibly write that would fire: {{{ {-# LANGUAGE TypeFamilies #-} type family Unit a :: * type instance Unit Integer = () {-# INLINE [1] int #-} {-# RULES "int" int = fromInteger :: Integer -> Int #-} -- int :: (Integral i, Unit i ~ ()) => i -> Int -- doesn't fire int :: (Integral i) => i -> Int -- fires int = fromIntegral }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7611#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7611: Rewrite rules application prevented by type variable application (map id vs. map (\x -> x)) ---------------------------------+------------------------------------------ Reporter: nomeata | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.2 Keywords: | Os: Unknown/Multiple Architecture: Unknown/Multiple | Failure: Runtime performance bug Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | ---------------------------------+------------------------------------------ Changes (by igloo): * difficulty: => Unknown * milestone: => 7.8.1 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7611#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC