#5059: Pragma to SPECIALISE on value arguments
---------------------------------+------------------------------------------
Reporter: batterseapower | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.0.3
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by simonpj):
I wonder if you could just write
{{{
{-# RULES "f/spec" f defaultOpts = f_spec_1 #-}
f_spec_1 = inline f defaultOpts -- NB: body of f duplicated
}}}
The `inline` pseudo-function makes `f` inline just once, which is what you
want. (I'm not certain that it works for recursive functions, but it
probably should.)
So this isn't quite a compact as a language extension, but every language
extension carries its own costs (eg explaining the interaction with INLINE
pragmas, and this way means we don't need to make any changes.
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5059#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs