Last active
December 28, 2015 03:49
-
-
Save mlippens/7437702 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bar.coffee | |
root = exports ? this | |
C = root['contracts-js'] | |
{id,hi} = C.use root['foo'], "bar" | |
console.log id 3#ok | |
console.log hi 2 | |
#Uncaught Error: Contract violation: expected <Num>, actual: "hello" | |
#Value guarded in: bar -- blame is on: foo | |
#Parent contracts: | |
#(Num) -> Num |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# foo.coffee | |
root = exports ? this | |
C = root['contracts-js'] | |
exports = C.exports "foo" | |
exports.id = C.guard(C.fun(C.Num,C.Num),(x)->x) | |
exports.hi = C.guard(C.fun(C.Num,C.Num),(x)-> "hello") | |
root['foo'] = exports |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> | |
<script src="libs/contracts.js"></script> | |
<script src="foo.js"></script> | |
<script src="bar.js"></script> | |
</head> | |
<body> | |
<p> Look at the console yo!</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment