Imported definition not specialized
As of b6f7d145, I am trying to get GHC to specialize away all dictionary-passing, but it is failing in a very simple cross-module case.
Given the following two modules:
module Print where
import Prelude (String, IO, putStrLn, Show(..))
print :: (Show a) => a -> IO ()
print x = putStrLn (show x)
module Main1 (main) where
import Print
import Prelude (Show(..), IO)
data T = A | B deriving Show
main :: IO ()
main = print A
I am compiling Main1
with the following optimization flags:
-fspecialise -fenable-rewrite-rules \
-fspecialise-aggressively -fsolve-constant-dicts -fcross-module-specialise \
-fexpose-all-unfoldings
I expected the combination of expose-all-unfoldings
and cross-module-specialise
to result in a T
-specialized print
, but alas, the main
I get still has dictionary passing:
-- RHS size: {terms: 3, types: 1, coercions: 0, joins: 0/0}
main :: IO ()
[GblId]
main = print @T Main1.$fShowT Main1.A
What is missing here to specialize print
?