[project @ 1999-06-28 16:23:28 by simonpj]
authorsimonpj <unknown>
Mon, 28 Jun 1999 16:23:28 +0000 (16:23 +0000)
committersimonpj <unknown>
Mon, 28 Jun 1999 16:23:28 +0000 (16:23 +0000)
commit960223bfc3fd1c2ac4608b837fb83f3bc6b5fd16
tree126460989881ffe3910df3c155f547bd940c9ba1
parent9956bafe44c39e07dff0c569dedc5cef3b41dbc7
[project @ 1999-06-28 16:23:28 by simonpj]
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.
ghc/compiler/typecheck/TcBinds.lhs