-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
349 additions
and
868 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../src/main/javascript/monad.js" type="text/javascript"></script> | ||
<script src="bower_components/underscore/underscore-min.js" type="text/javascript"></script> | ||
<script src="bower_components/jquery/jquery.min.js" type="text/javascript"></script> | ||
<title>Example IO page</title> | ||
</head> | ||
<body> | ||
|
||
<span id="SomeId">Some text</span> | ||
|
||
<div> | ||
<span>first name: <input type="text" id="firstName"/> </span> | ||
<span>last name: <input type="text" id="lastName"/> </span> | ||
<span>postcode: <input type="text" id="postcode"/> </span> | ||
</div> | ||
|
||
<div> | ||
<span>Result:</span> <span id="result"></span> | ||
</div> | ||
|
||
<script> | ||
|
||
|
||
function idFunction(id) { | ||
return id | ||
} | ||
|
||
|
||
var a = List(2,List(1,Nil)) | ||
|
||
|
||
var getId = $.io1() | ||
|
||
var getTextForId = function (id) { | ||
return getId(id).map(getText) | ||
} | ||
|
||
var getValForId = function (id) { | ||
return getId(id).map(getVal) | ||
} | ||
|
||
var getText = function (o) { | ||
return o.text() | ||
} | ||
|
||
var setHtml = function (html, o) { | ||
return o.html(html) | ||
}.curry() | ||
|
||
var setText = function (text, e) { | ||
return e.text(text) | ||
}.curry() | ||
|
||
var getVal = function (o) { | ||
return o.val() | ||
} | ||
|
||
var writer = function (writeFn, id, content) { | ||
return getId(id).map(writeFn(content)) | ||
}.curry() | ||
|
||
var addAwesomeness = function (text) { | ||
return text + " now with awesomeness" | ||
} | ||
|
||
getId("#SomeId").map(getText.andThen(addAwesomeness)).flatMap(writer(setText)("#SomeId")).run() | ||
|
||
</script> | ||
|
||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.