Skip to content

Instantly share code, notes, and snippets.

@ccorcos
Created March 28, 2017 20:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ccorcos/f86678c0e4d2d9ebcc5a7c12046440d4 to your computer and use it in GitHub Desktop.
Save ccorcos/f86678c0e4d2d9ebcc5a7c12046440d4 to your computer and use it in GitHub Desktop.
type state = int;
type action =
| Inc
| IncBy int
| Dec
| DecBy int
| Reset;
let update state action =>
switch action {
| Inc => state + 1
| IncBy n => state + n
| Dec => state - 1
| DecBy n => state - n
| Reset => 0
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment