Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Apply substitutions

  • Loading branch information...
commit 5068fc396609a58cdc8ad5c101c7dd3d66ee8556 1 parent 891440c
@phyrex1an phyrex1an authored
Showing with 4 additions and 2 deletions.
  1. +4 −2 haskell.hiji.js
View
6 haskell.hiji.js
@@ -216,12 +216,14 @@ commands[":type"] = "TYPE";
var arg = trim(input.substr(command.length));
var ast = haskell.parser.parse('{' + arg + '}').ast.expr;
var tc = haskell.typechecker;
- var infered = ast.infer(new tc.Environment(new tc.Assumps(), new tc.Subst(), new tc.NameGen()));
+ 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(", ");
if (predsString.length > 0) {
predsString = "(" + predsString + ") => ";
}
- var newLine = ast.stringify() + " :: " + predsString + infered.type.toString();
+ var newLine = ast.stringify() + " :: " + predsString + subst.toString();
$("ol").append(makeOutput(newLine));
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.