Skip to content

Instantly share code, notes, and snippets.

@hughfdjackson
Created June 21, 2014 23:47
Show Gist options
  • Select an option

  • Save hughfdjackson/e8daf9e6de3edae2d78f to your computer and use it in GitHub Desktop.

Select an option

Save hughfdjackson/e8daf9e6de3edae2d78f to your computer and use it in GitHub Desktop.
type State = { prev: Int, curr: Int }
tick = every second
updateState timestamp state = { state | prev <- state.curr, curr <- timestamp }
main = lift asText <| foldp updateState { prev = 0, curr = 0 } tick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment