2

タイトな内部ループで使用されるメソッドの特殊化を行おうとしていますが、GHC は次のことについて不平を言っています:

src/Mac/CoreGraphics/Image.hs:140:1: Warning:
    You cannot SPECIALISE `toRealFrac'
      because its definition has no INLINE/INLINABLE pragma
      (or its defining module `Data.Image.Pixel' was compiled without -O)

src/Mac/CoreGraphics/Image.hs:140:1: Warning:
    Ignoring useless SPECIALISE pragma for class method selector `toRealFrac'

ただし、明らかに -O でビルドされています。

/usr/local/bin/ghc --make -no-link -fbuilding-cabal-package -O -static -outputdir dist/build/imagesorter-hs/imagesorter-hs-tmp -odir dist/build/imagesorter-hs/imagesorter-hs-tmp -hidir dist/build/imagesorter-hs/imagesorter-hs-tmp -stubdir dist/build/imagesorter-hs/imagesorter-hs-tmp -i -idist/build/imagesorter-hs/imagesorter-hs-tmp -isrc -idist/build/autogen -Idist/build/autogen -Idist/build/imagesorter-hs/imagesorter-hs-tmp -optP-include -optPdist/build/autogen/cabal_macros.h -hide-all-packages -package-db dist/package.conf.inplace -package-id base-4.6.0.1-6c351d70a24d3e96f315cba68f3acf57 -XHaskell2010 src/ImageSorter.hs

そして明らかに、私は INLINABLE プラグマを持っています:

instance PixelComponent Word8 where
  minValue = minBound
  maxValue = maxBound
  toRealFrac c = fromIntegral c / fromIntegral (maxValue :: Word8)
  {-# INLINABLE toRealFrac #-}

それで、私は何を間違っていますか?

4

0 に答える 0