Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Filters out inrelevant predicates

  • Loading branch information...
commit face0555b4b24c1f6f427c5c542d6434a1853416 1 parent 5068fc3
@phyrex1an phyrex1an authored
Showing with 9 additions and 4 deletions.
  1. +8 −3 haskell.hiji.js
  2. +1 −1  haskell.typechecker.js
View
11 haskell.hiji.js
@@ -218,12 +218,17 @@ commands[":type"] = "TYPE";
var tc = haskell.typechecker;
var env = new tc.Environment(new tc.Assumps(), new tc.Subst(), new tc.NameGen());
var infered = ast.infer(env);
- var subst = infered.type.apply(env.getSubst());
- var predsString = infered.preds.map(function(p) { return p.toString(); }).join(", ");
+ var type = infered.type.apply(env.getSubst());
+ var preds = infered.preds.filter(
+ function (p) {
+ return tc.elem(type.tv(), p.type());
+ }
+ );
+ var predsString = preds.map(function(p) { return p.toString(); }).join(", ");
if (predsString.length > 0) {
predsString = "(" + predsString + ") => ";
}
- var newLine = ast.stringify() + " :: " + predsString + subst.toString();
+ var newLine = ast.stringify() + " :: " + predsString + type.toString();
$("ol").append(makeOutput(newLine));
}
}
View
2  haskell.typechecker.js
@@ -34,7 +34,7 @@
return p.compare(pp);
});
};
-
+ typechecker.elem = elem;
typechecker.any = any;
var all = function(arr, f) {
Please sign in to comment.
Something went wrong with that request. Please try again.