[GHC] #7112: No inlining in the presence of non-instantiated phantom type
GHC
cvs-ghc at haskell.org
Fri Aug 3 12:12:29 CEST 2012
#7112: No inlining in the presence of non-instantiated phantom type
------------------------------+---------------------------------------------
Reporter: dreixel | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Consider the following code:
{{{
data U a = U
g :: [U a]
g = [U]
f :: [Int]
f = map (\U -> 2) g
}}}
Compiled with -O1, `g` does not get inlined, and `f` stays unchanged.
Inline pragmas don't seem to help. However, if we change the type
signature of `g` to instantiate the phantom type parameter, such as with
`g :: [U ()]`, then `f` is nicely optimised to become `[2]`. I believe
this is a bug, and we'd like `f` to be simplified even when `g` has its
most general type signature.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7112>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list