Skip to content

Instantly share code, notes, and snippets.

@eagletmt
Created April 5, 2010 18:35
Show Gist options
  • Save eagletmt/356697 to your computer and use it in GitHub Desktop.
Save eagletmt/356697 to your computer and use it in GitHub Desktop.
commands.addUserCommand(['hseval'], 'evaluate haskell expression',
function(args) {
util.httpGet('http://tryhaskell.org/haskell.json?method=eval&expr=' + encodeURIComponent(args.literalArg), function(res) {
let json = JSON.parse(res.responseText);
if (json.error) {
liberator.echoerr('error: ' + json.error);
} else if (json.exception) {
liberator.echoerr('exception: ' + json.exception);
} else {
liberator.echo(json.result + ' :: ' + json.type);
}
});
}, { literal: 0 }, true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment