* included in the distribution.
*
* $RCSfile: preds.c,v $
- * $Revision: 1.9 $
- * $Date: 1999/11/17 16:57:43 $
+ * $Revision: 1.10 $
+ * $Date: 2000/03/06 08:38:04 $
* ------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------
if (nonNull(in)) {
Int beta = typeOff;
Cell e = inst(in).builder;
- Cell es = inst(in).specifics;
+ List es = inst(in).specifics;
+ List fs = NIL;
+ for (; nonNull(es); es=tl(es))
+ fs = cons(triple(hd(es),mkInt(beta),NIL),fs);
+ fs = rev(fs);
+ improve(0,ps,fs);
#if EXPLAIN_INSTANCE_RESOLUTION
if (showInstRes) {
for (i = 0; i < d; i++)
fputc(' ', stdout);
fputs("try ", stdout);
- printContext(stdout, es);
+ printContext(stdout, copyPreds(fs));
fputs(" => ", stdout);
- printPred(stdout, inst(in).head);
+ printPred(stdout, copyPred(inst(in).head,beta));
fputc('\n', stdout);
}
#endif
- /* would need to lift es to triples, so be lazy, and just
- use improve1 in the loop */
- /* improve(0,ps,es); */
- for (; nonNull(es); es=tl(es)) {
+ for (es=inst(in).specifics; nonNull(es); es=tl(es)) {
Cell ev;
- improve1(0,ps,hd(es),beta);
ev = entail(ps,hd(es),beta,d);
if (nonNull(ev))
e = ap(e,ev);
if (nonNull(ev)) { /* Discharge if ps ||- (pi,o) */
overEvid(thd3(hd(p)),ev);
- } else if (!isAp(pi) || isIP(fun(pi)) || !anyGenerics(pi,o)) {
+ } else if (isIP(fun(pi))) {
+ tl(p) = rems;
+ rems = p;
+ } else if (!isAp(pi) || !anyGenerics(pi,o)) {
tl(p) = sps; /* Defer if no generics */
sps = p;
}
* included in the distribution.
*
* $RCSfile: static.c,v $
- * $Revision: 1.23 $
- * $Date: 2000/02/04 13:41:00 $
+ * $Revision: 1.24 $
+ * $Date: 2000/03/06 08:38:04 $
* ------------------------------------------------------------------------*/
#include "prelude.h"
ps = tl(ps);
if (its++ >= factor*cutoff) {
Cell bpi = inst(in).head;
- Cell pi = copyPred(fun(p),intOf(snd(p)));
ERRMSG(inst(in).line) "\n*** Cannot derive " ETHEN ERRPRED(bpi);
ERRTEXT " after %d iterations.", its-1 ETHEN
ERRTEXT
}
mapProc(checkImportList, unqualImports);
+ /* Note: there's a lot of side-effecting going on here, so
+ don't monkey about with the order of operations here unless
+ you know what you are doing */
if (!combined) linkPreludeTC(); /* Get prelude tycons and classes */
mapProc(checkTyconDefn,tyconDefns); /* validate tycon definitions */
checkSynonyms(tyconDefns); /* check synonym definitions */
mapProc(checkClassDefn,classDefns); /* process class definitions */
mapProc(kindTCGroup,tcscc(tyconDefns,classDefns)); /* attach kinds */
+ mapProc(visitClass,classDefns); /* check class hierarchy */
mapProc(extendFundeps,classDefns); /* finish class definitions */
+ /* (convenient if we do this after */
+ /* calling `visitClass' so that we */
+ /* know the class hierarchy is */
+ /* acyclic) */
+
mapProc(addMembers,classDefns); /* add definitions for member funs */
- mapProc(visitClass,classDefns); /* check class hierarchy */
if (!combined) linkPreludeCM(); /* Get prelude cfuns and mfuns */
* included in the distribution.
*
* $RCSfile: type.c,v $
- * $Revision: 1.23 $
- * $Date: 2000/02/03 13:55:22 $
+ * $Revision: 1.24 $
+ * $Date: 2000/03/06 08:38:05 $
* ------------------------------------------------------------------------*/
#include "prelude.h"
List qs; {
static String boolQual = "boolean qualifier";
static String genQual = "generator";
+#if IPARAM
+ List svPreds;
+#endif
STACK_CHECK
- if (isNull(qs)) /* no qualifiers left */
- fst(e) = typeExpr(l,fst(e));
- else {
+ if (isNull(qs)) { /* no qualifiers left */
+ spTypeExpr(l,fst(e));
+ } else {
Cell q = hd(qs);
List qs1 = tl(qs);
switch (whatIs(q)) {
- case BOOLQUAL : check(l,snd(q),NIL,boolQual,typeBool,0);
+ case BOOLQUAL : spCheck(l,snd(q),NIL,boolQual,typeBool,0);
typeComp(l,m,e,qs1);
break;
case FROMQUAL : { Int beta = newTyvars(1);
saveVarsAss();
- check(l,snd(snd(q)),NIL,genQual,m,beta);
+ spCheck(l,snd(snd(q)),NIL,genQual,m,beta);
enterSkolVars();
fst(snd(q))
= typeFreshPat(l,patBtyvs(fst(snd(q))));
}
break;
- case DOQUAL : check(l,snd(q),NIL,genQual,m,newTyvars(1));
+ case DOQUAL : spCheck(l,snd(q),NIL,genQual,m,newTyvars(1));
typeComp(l,m,e,qs1);
break;
}
Int to;
Int tf;
Int i;
+#if IPARAM
+ List svPreds;
+#endif
instantiate(name(c).type);
for (; nonNull(predsAre); predsAre=tl(predsAre))
if (isPolyOrQualType(t))
snd(hd(fs)) = typeExpected(l,conExpr,snd(hd(fs)),t,to,tf,TRUE);
else {
- check(l,snd(hd(fs)),e,conExpr,t,to);
+ spCheck(l,snd(hd(fs)),e,conExpr,t,to);
}
}
for (i=name(c).arity; i>0; i--)
Int alpha = newTyvars(2+n);
Int i;
List fs1;
+#if IPARAM
+ List svPreds;
+#endif
/* Calculate type and translation for each expr in the field list */
for (fs1=fs, i=alpha+2; nonNull(fs1); fs1=tl(fs1), i++) {
- snd(hd(fs1)) = typeExpr(line,snd(hd(fs1)));
+ spTypeExpr(line,snd(hd(fs1)));
bindTv(i,typeIs,typeOff);
}
ts = rev(ts);
/* Type check expression to be updated */
- fst3(snd(e)) = typeExpr(line,fst3(snd(e)));
+ spTypeExpr(line,fst3(snd(e)));
bindTv(alpha,typeIs,typeOff);
for (; nonNull(cs); cs=tl(cs)) { /* Loop through constrs */
Int beta = newKindedVars(inst(in).kinds);
List params = makePredAss(inst(in).specifics,beta);
Cell d = inventDictVar();
+ /*
List evids = cons(triple(inst(in).head,mkInt(beta),d),
appendOnto(dupList(params),supers));
+ */
+ List evids = dupList(params);
List imps = inst(in).implements;
Cell l = mkInt(inst(in).line);
static String guarded = "guarded expression";
static String guard = "guard";
Int line = intOf(fst(gded));
+#if IPARAM
+ List svPreds;
+#endif
gded = snd(gded);
- check(line,fst(gded),NIL,guard,typeBool,0);
- check(line,snd(gded),NIL,guarded,aVar,beta);
+ spCheck(line,fst(gded),NIL,guard,typeBool,0);
+ spCheck(line,snd(gded),NIL,guarded,aVar,beta);
}
Cell rhsExpr(rhs) /* find first expression on a rhs */