-
Simon Peyton Jones authored
Roman produced programs involving associated types that did not optimise well. His programs were something like this: data family T a data instance T Int = MkT Bool Char bar :: T Int -> Int bar t = t `seq` loop 0 where loop = ... You'd think that the `seq` should unbox 't' outside the loop, since a (T Int) is just a MkT pair. The most robust way to make this happen is for the simplifier to understand a bit about type-family instances. See Note [Improving seq] in Simplify.lhs. We use FamInstEnv.topNormaliseType to do the interesting work. To make this happen I did a bit of refactoring to the simplifier monad. I'd previously done a very similar transformation in LiberateCase, but it was happening too late. So this patch takes it out of LiberateCase as well as adding it to Simplify.
9670d664