Allow SPECIALISE pragmas for functions defined in another module
See http://www.haskell.org/pipermail/glasgow-haskell-users/2010-July/019042.html
say I have
module A where
class C a where ...
f :: C a => String -> a
module B where
import A
data T = ...
instance C T where ...
g :: String -> SomeOtherType
g s = doSomethingWith (f s)
Is it possible to SPECIALIZE f
for the type T
? Currently no.
Some care would be needed to support this. Currently GHC's -fexpose-all-unfoldings
makes no attempt to ensure that the exposed unfolding for f is exactly what the user originally wrote. For example, other functions might have been inlined into f's RHS that might make it a lot bigger. Maybe you'd want to say
{-# SPECIALISABLE f #-}
f = <blah>
to mean "expose f's unfolding, pretty much as-is, rather than optimising it". This is close to what you get with
{-# INLINE f #-}
(which also exposes the original RHS) but without the "please inline me at every call site" meaning.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | sebf@informatik.uni-kiel.de |
Operating system | |
Architecture |