Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample not quite working? #2

Open
tedneward opened this issue Jan 11, 2014 · 0 comments
Open

Sample not quite working? #2

tedneward opened this issue Jan 11, 2014 · 0 comments

Comments

@tedneward
Copy link

I do the sample from the README:

var contracts = require("contracts-js");
setupContracts(contracts);

fun (Num) -> Num
function dbl(x) { return x + x; }

console.log(dbl(4));

But when I run, it fails because "npm install sweet-contracts" doesn't seem to have "contracts-js" as a dependency. No worries; I "npm install contracts-js" and that works fine--it's installed. When I "sweet-contract" the source above, no errors. But when I run, I get "ReferenceError: C is not defined"; the output file looks like this:

var contracts$0 = require('contracts-js');
var C$2 = contracts$0;
var dbl$5 = C.guard(C.fun([C.Num], C.Num), function (x$8) {
return x$8 + x$8;
});
console.log(dbl$5(4));

Sure enough, if I manually edit the output to change "C$2" to "C", it works great. It looks like C is getting picked up by another macro and transformed.

Is this a known issue, am I doing this wrong, or am I misunderstanding things here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant