SPECIALIZE silently fails to apply
I have a small example where GHC refuses to specialize a call to (+), compiling with -O2.
The two files are Foo.hs and Main.hs within $6038.
There seem to be two problems:
- The active
SPECIALIZEpragma should be applied, but isn't. This can be seen by comparing the core and runtimes offcTest(slow) vsvtTest(fast). I need this version of the pragma in my real code as the phantom typemis reified, so I need to specialize the vector code without specifying the phantom type. - I can get
fcTestto run fast if I use the commented-outSPECIALIZEpragma instead. However, that pragma seems very straightforward to me (all types are concrete). The docs indicate that GHC should automatically specialize in most cases, why does it not specialize to the commented-out signature automatically?
This problem is also posted here: http://stackoverflow.com/questions/21071706/specialization-with-constraints
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.6.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |
Edited by Simon Jakobi