Wed May 23 04:48:18 PDT 2007  [EMAIL PROTECTED]
  * Improve the interaction of 'seq' and associated data types
  
  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.
  
  
  

    M ./compiler/simplCore/LiberateCase.lhs -70 +6
    M ./compiler/simplCore/SimplCore.lhs -7 +10
    M ./compiler/simplCore/SimplEnv.lhs -12 +5
    M ./compiler/simplCore/SimplMonad.lhs -24 +37
    M ./compiler/simplCore/Simplify.lhs -30 +86
    M ./compiler/types/FamInstEnv.lhs -84 +89

_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to