Skip to content
Snippets Groups Projects
Forked from Glasgow Haskell Compiler / GHC
Source project has a limited visibility.
user avatar
Simon Peyton Jones authored
Fix lost specialisations.  There were two problems

	{-# SPECIALISE f :: Int -> Rational #-}
	fromIntegral	=  fromInteger . toInteger

This generates

	fromIntegral_spec = fromIntegral d

for some suitable dictionary d.  But since fromIntegral is small,
it got inlined into fromIntegral_spec, thus losing the specialised
call (fromIntegral d) that was the whole raison d'etre of fromIntegral_spec.
Haskish solution: add an inlne pragma for the _spec things:

	fromIntegral_spec = _inline_me (fromIntegral d)

Now we won't inline inside.  But this showed up a related problem.  The
typechecker tries to common up overloaded things, so it actually generates

	m = fromIntegral d
	fromIntegral_spec = _inline_me m

which is pretty stupid.  Using tcSimplifyToDicts (instead of tcSimplify)
in TcBinds.tcSpecSigs fixes this.
960223bf
History
Name Last commit Last update