Skip to content

Instantly share code, notes, and snippets.

@awto
Last active June 11, 2018 17:04
Show Gist options
  • Select an option

  • Save awto/064a0333f3b9607b768f13535ceb4127 to your computer and use it in GitHub Desktop.

Select an option

Save awto/064a0333f3b9607b768f13535ceb4127 to your computer and use it in GitHub Desktop.
state via abstract layer
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