Browse files

Started working on :t command

  • Loading branch information...
1 parent 831dacf commit 730852745fc3548ede0a7cddd1370acd8ee70eec Mikael Bung committed May 20, 2010
Showing with 10 additions and 1 deletion.
  1. +10 −1 haskell.hiji.js
View
11 haskell.hiji.js
@@ -11,6 +11,8 @@ commands[":l"] = "LOAD";
commands[":load"] = "LOAD";
commands[":h"] = "HELP";
commands[":help"] = "HELP";
+commands[":t"] = "TYPE";
+commands[":type"] = "TYPE";
(function($){
@@ -245,7 +247,14 @@ commands[":help"] = "HELP";
// $('.input').after(output).replaceWith(newLine);
// $('.input').after(output).replaceWith(newLine);
$("ol").append(makeInput(modules));
- }
+ } else if (commands[command] == "TYPE") {
+ var arg = trim(input.substr(command.length));
+ var ast = haskell.parser.parse(arg).ast;
+ var type = ast.infer(/* some env */);
+ var newLine = ast.stringify() + " :: " + type.stringify();
+ $('.input').after(output).replaceWith(newLine);
+ $("ol").append(makeInput(modules));
+ }
}
};

0 comments on commit 7308527

Please sign in to comment.