• simonpj's avatar
    [project @ 2001-03-08 11:59:02 by simonpj] · d78151f6
    simonpj authored
    	Remove function coercions
        (coerce (T1->T2) (S1->S2) F) E
        coerce T2 S2 (F (coerce S1 T1 E))
    This is a generally good transformation, but it
    still doesn't solve the problem I was after.  Consider
      newtype T = MkT (Int -> Int)
      p :: T->T;   p = ...
      q :: T;      q = ...
      foo :: T
      {-# INLINE foo #-}
      foo = p $ q
      f = \y -> ...((coerce (Int->Int) foo) 3)...
    Trouble is, foo doesn't see the argument because of the coerce, so it
    thinks it's a lone variable and doesn't inline.
    Another problem is that since $ ins't inlined into foo's RHS, foo
    looks like a redex, which we are reluctant to inline inside a lambda,
    even with an INLINE pragma.  Maybe we should be bolder?
    Anyway, this commit is an improvement to Simplify, but the story is not
Simplify.lhs 58.3 KB