RULES and unfolding

Manuel M. T. Chakravarty chak@cse.unsw.edu.au
Sat, 30 Dec 2000 18:58:28 +1100


Is there any heuristic in GHC that discourages putting
unfoldings of functions into .hi files if the function
occurs on the right handside of a RULES rule?

I have code, where this seems to be the case.  When I remove
the rewrite rule, the function is placed into the .hi file,
but with the rewrite rule, it isn't - despite an INLINE
pragma for that function!  Unfortunately, the example is
rather big and I didn't manage to find a small piece of code
showing the same behaviour yet.

This currently bites me in a rule of the form

  {-# "" forall ... foo .. bar .. = foobar .. #-}

  {-# INLINE foobar #-}
  foobar .. = ...

where I want foobar inlined.

Cheers,
Manuel

PS: I do this only because GHC crashes when I place the rhs
    of the foobar definition directly into the rhs of the
    rule, but again I don't have a small example producing
    the bug *sigh*