+static Void local kindError ( Int,Constr,Constr,String,Kind,Int );
+static Void local checkQualImport ( Pair );
+static Void local checkUnqualImport ( Triple );
+
+static Name local lookupName ( Text,List );
+static List local checkSubentities ( List,List,List,String,Text );
+static List local checkExportTycon ( List,Text,Cell,Tycon );
+static List local checkExportClass ( List,Text,Cell,Class );
+static List local checkExport ( List,Text,Cell );
+static List local checkImportEntity ( List,Module,Cell );
+static List local resolveImportList ( Module,Cell );
+static Void local checkImportList ( Pair );
+
+static Void local importEntity ( Module,Cell );
+static Void local importName ( Module,Name );
+static Void local importTycon ( Module,Tycon );
+static Void local importClass ( Module,Class );
+static List local checkExports ( List, Module );
+
+static Void local checkTyconDefn ( Tycon );
+static Void local depConstrs ( Tycon,List,Cell );
+static List local addSels ( Int,Name,List,List );
+static List local selectCtxt ( List,List );
+static Void local checkSynonyms ( List );
+static List local visitSyn ( List,Tycon,List );
+static Type local instantiateSyn ( Type,Type );
+
+static Void local checkClassDefn ( Class );
+static Cell local depPredExp ( Int,List,Cell );
+static Void local checkMems ( Class,List,Cell );
+static Void local checkMems2 ( Class,Cell );
+static Void local addMembers ( Class );
+static Name local newMember ( Int,Int,Cell,Type,Class );
+static Text local generateText ( String,Class );
+
+static List local classBindings ( String,Class,List );
+static Name local memberName ( Class,Text );
+static List local numInsert ( Int,Cell,List );
+
+static List local maybeAppendVar ( Cell,List );
+
+static Type local checkSigType ( Int,String,Cell,Type );
+static Void local checkOptQuantVars ( Int,List,List );
+static Type local depTopType ( Int,List,Type );
+static Type local depCompType ( Int,List,Type );
+static Type local depTypeExp ( Int,List,Type );
+static Type local depTypeVar ( Int,List,Text );
+static List local checkQuantVars ( Int,List,List,Cell );
+static List local otvars ( Cell,List );
+static Bool local osubset ( List,List );
+static Void local kindConstr ( Int,Int,Int,Constr );
+static Kind local kindAtom ( Int,Constr );
+static Void local kindPred ( Int,Int,Int,Cell );
+static Void local kindType ( Int,String,Type );
+static Void local fixKinds ( Void );
+
+static Void local kindTCGroup ( List );
+static Void local initTCKind ( Cell );
+static Void local kindTC ( Cell );
+static Void local genTC ( Cell );
+
+static Void local checkInstDefn ( Inst );
+static Void local insertInst ( Inst );
+static Bool local instCompare ( Inst,Inst );
+static Name local newInstImp ( Inst );
+static Void local kindInst ( Inst,Int );
+static Void local checkDerive ( Tycon,List,List,Cell );
+static Void local addDerInst ( Int,Class,List,List,Type,Int );
+static Void local deriveContexts ( List );
+static Void local initDerInst ( Inst );
+static Void local calcInstPreds ( Inst );
+static Void local maybeAddPred ( Cell,Int,Int,List );
+static List local calcFunDeps ( List );
+static Cell local copyAdj ( Cell,Int,Int );
+static Void local tidyDerInst ( Inst );
+static List local otvarsZonk ( Cell,List,Int );
+
+static Void local addDerivImp ( Inst );
+
+static Void local checkDefaultDefns ( Void );
+
+static Void local checkForeignImport ( Name );
+static Void local checkForeignExport ( Name );
+
+static Cell local tidyInfix ( Int,Cell );
+static Pair local attachFixity ( Int,Cell );
+static Syntax local lookupSyntax ( Text );
+
+static Cell local checkPat ( Int,Cell );
+static Cell local checkMaybeCnkPat ( Int,Cell );
+static Cell local checkApPat ( Int,Int,Cell );
+static Void local addToPatVars ( Int,Cell );
+static Name local conDefined ( Int,Cell );
+static Void local checkIsCfun ( Int,Name );
+static Void local checkCfunArgs ( Int,Cell,Int );
+static Cell local checkPatType ( Int,String,Cell,Type );
+static Cell local applyBtyvs ( Cell );
+static Cell local bindPat ( Int,Cell );
+static Void local bindPats ( Int,List );
+
+static List local extractSigdecls ( List );
+static List local extractFixdecls ( List );
+static List local extractBindings ( List );
+static List local getPatVars ( Int,Cell,List );
+static List local addPatVar ( Int,Cell,List );
+static List local eqnsToBindings ( List,List,List,List );
+static Void local notDefined ( Int,List,Cell );
+static Cell local findBinding ( Text,List );
+static Cell local getAttr ( List,Cell );
+static Void local addSigdecl ( List,Cell );
+static Void local addFixdecl ( List,List,List,List,Triple );
+static Void local dupFixity ( Int,Text );
+static Void local missFixity ( Int,Text );
+
+static List local dependencyAnal ( List );
+static List local topDependAnal ( List );
+static Void local addDepField ( Cell );
+static Void local remDepField ( List );
+static Void local remDepField1 ( Cell );
+static Void local clearScope ( Void );
+static Void local withinScope ( List );
+static Void local leaveScope ( Void );
+static Void local saveSyntax ( Cell,Cell );
+
+static Void local depBinding ( Cell );
+static Void local depDefaults ( Class );
+static Void local depInsts ( Inst );
+static Void local depClassBindings ( List );
+static Void local depAlt ( Cell );
+static Void local depRhs ( Cell );
+static Void local depGuard ( Cell );
+static Cell local depExpr ( Int,Cell );
+static Void local depPair ( Int,Cell );
+static Void local depTriple ( Int,Cell );
+static Void local depComp ( Int,Cell,List );
+static Void local depCaseAlt ( Int,Cell );
+static Cell local depVar ( Int,Cell );
+static Cell local depQVar ( Int,Cell );
+static Void local depConFlds ( Int,Cell,Bool );
+static Void local depUpdFlds ( Int,Cell );
+static List local depFields ( Int,Cell,List,Bool );
+#if IPARAM
+static Void local depWith ( Int,Cell );
+static List local depDwFlds ( Int,Cell,List );