Re: [GHC] #7398: RULES don't apply to a newtype constructor

#7398: RULES don't apply to a newtype constructor -------------------------------------+------------------------------------- Reporter: shachaf | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 7.6.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime | Unknown/Multiple performance bug | Test Case: Blocked By: | Blocking: Related Tickets: #6082, #10418, | Differential Rev(s): #13290 | Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata):
The alternative is to try to make the rule work after inlining MkT, by being clever about casts. That might be possible.
We somewhat do this already: We have {{{ {-# RULES "map/coerce" [1] map coerce = coerce #-} }}} which fires in all these cases: {{{ foo :: [Int] -> [Int] foo = map id fooAge :: [Int] -> [Age] fooAge = map Age fooCoerce :: [Int] -> [Age] fooCoerce = map coerce fooUnsafeCoerce :: [Int] -> [Age] fooUnsafeCoerce = map unsafeCoerce }}} (this is `testsuite/tests/simplCore/should_run/T2110.hs`). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7398#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC