patch applied (ghc): Log message for: Fix a nasty recursive loop in typechecking interface files

Simon Peyton Jones <[email protected]> Thu, 11 Jan 2007 01:17:39 -0800
Newsgroups gmane.comp.lang.haskell.cvs.all,gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Thu Jan 11 01:02:52 PST 2007  [email protected]
  * Log message for: Fix a nasty recursive loop in typechecking interface files
  
  (Alas, Darcs failed to record my log-message for the above patch, 
  so this patch is an attempt to add the log message retrospectively.)
  
  Roman found a case where the type-checker for interface files
  would go into a loop.  Here it is:
  
    module BarAT where
      class Foo a where
        data FooT a :: *
        int :: FooT a -> Int
  
    module Baz where
      import BarAT
      foo :: FooT Int -> Int
      foo = foo
  
  The trouble turned out to be that Foo gives rise to a *newtype*,
  and using a newtpe caused a little bit too much strictness in 
  BuildTyCl.mkNewTyConRhs.  Specifically, mkNewTypeCoercion did pattern
  matching, which forced the call to eta_reduce in mkNewTyConRhs.
  
  This is all too delicate really.  But for now I've fixed the bug,
  and added an explanatory comment.  I'll add a test for it, in
  indexed-types/should_compile/ATLoop

    M ./compiler/iface/BuildTyCl.lhs -1 +1