Last active
June 11, 2018 17:04
-
-
Save awto/064a0333f3b9607b768f13535ceb4127 to your computer and use it in GitHub Desktop.
state via abstract layer
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
| const state = run(v => s => [v, s], | |
| (arg, fun) => s => { | |
| const [nextArg, nextState] = arg(s) | |
| return fun(nextArg)(nextState) | |
| }) | |
| function set(s) { return _ => [s, s] } | |
| function get(s) { return [s, s] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment