From 604afcb5b9c06bee56d3a89f5d0bcdb793bbfb10 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Thu, 11 Jan 2007 09:02:52 +0000 Subject: [PATCH] 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 --- compiler/iface/BuildTyCl.lhs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/iface/BuildTyCl.lhs b/compiler/iface/BuildTyCl.lhs index 0e50f95..864cb19 100644 --- a/compiler/iface/BuildTyCl.lhs +++ b/compiler/iface/BuildTyCl.lhs @@ -141,7 +141,7 @@ mkNewTyConRhs tycon_name tycon con etad_rhs :: Type -- return a TyCon without pulling on rhs_ty -- See Note [Tricky iface loop] in LoadIface (etad_tvs, etad_rhs) = eta_reduce (reverse tvs) rhs_ty - + eta_reduce :: [TyVar] -- Reversed -> Type -- Rhs type -> ([TyVar], Type) -- Eta-reduced version (tyvars in normal order) -- 1.7.10.4