Skip to content
  • Simon Peyton Jones's avatar
    [project @ 1999-06-28 16:23:28 by simonpj] · 960223bf
    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