Skip to content

Lots of missed specialisation warnings with GHC 9.2.1

module Test where

import Numeric.Natural (Natural)

even' :: Natural -> Bool
even' = even
$ ghc-9.2.1 -O -Wall-missed-specialisations even.hs
[1 of 1] Compiling Test             ( even.hs, even.o )

even.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘rem’
      when specialising ‘even’
    Probable fix: add INLINABLE pragma on ‘rem’

even.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘fromInteger’
      when specialising ‘even’
    Probable fix: add INLINABLE pragma on ‘fromInteger’

even.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘==’
      when specialising ‘even’
    Probable fix: add INLINABLE pragma on ‘==’

even.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘GHC.Classes.$p1Ord’
      when specialising ‘even’
    Probable fix: add INLINABLE pragma on ‘GHC.Classes.$p1Ord’

even.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘GHC.Real.$p2Real’
      when specialising ‘even’
    Probable fix: add INLINABLE pragma on ‘GHC.Real.$p2Real’

even.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘GHC.Real.$p1Real’
      when specialising ‘even’
    Probable fix: add INLINABLE pragma on ‘GHC.Real.$p1Real’

even.hs: warning: [-Wall-missed-specialisations]
    Could not specialise imported function ‘GHC.Real.$p1Integral’
      when specialising ‘even’
    Probable fix: add INLINABLE pragma on ‘GHC.Real.$p1Integral’

ghc-8.10.7 and ghc-9.3.20211111 don't report any of these warnings.

If 9.2.1 in fact doesn't expose unfoldings for rem, fromInteger or (==), that seems like a bug to me.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information