[GHC] #12632: Inline and Noinline pragmas ignored for instance functions
GHC
ghc-devs at haskell.org
Wed Sep 28 22:51:27 UTC 2016
#12632: Inline and Noinline pragmas ignored for instance functions
-------------------------------------+-------------------------------------
Reporter: jeremy-list | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect | Unknown/Multiple
warning at compile-time | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Ah now I see what you mean, thanks.
The thing is, in the RULE when you mention `inv` you are mentioning the
`inv` from the class declaration; and you probably do not want to put
NOINLINE on the class method (and I doubt that works anyway).
I think you want the rule to work for "the `inf` at type `Bool`". The
easiest way to do that is to name it:
{{{
instance Inv Bool where
inv = invBool
invBool :: Bool -> Bool
{-# NOINLINE invBool #-}
invBool = not
{-# RULES "force-inline" forall (a :: Bool) . invBool a = not a #-}
}}}
Now I think you'll find it works fine. It's a little less direct, but
much more explicit and robust.
Simon
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12632#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list