diff options
| author | Talia Ringer | 2019-06-07 06:59:16 -0400 |
|---|---|---|
| committer | Talia Ringer | 2019-06-13 12:40:51 -0400 |
| commit | 2f5fefcd76259d5e0aee5ef5076ae4c4dd662ec1 (patch) | |
| tree | f167bb4373c4b305c0b87b436f5a256f623f81a1 /doc/plugin_tutorial/tuto2/src/counter.ml | |
| parent | ac854a5542b2118be5dfd7bd26d9e3a5db945167 (diff) | |
Update, expand, and document plugin tutorial 2
Diffstat (limited to 'doc/plugin_tutorial/tuto2/src/counter.ml')
| -rw-r--r-- | doc/plugin_tutorial/tuto2/src/counter.ml | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/doc/plugin_tutorial/tuto2/src/counter.ml b/doc/plugin_tutorial/tuto2/src/counter.ml new file mode 100644 index 0000000000..8721090d42 --- /dev/null +++ b/doc/plugin_tutorial/tuto2/src/counter.ml @@ -0,0 +1,22 @@ +(* + * This file defines our counter, which we use in the Count command. + *) + +(* + * Our counter is simply a reference called "counter" to an integer. + * + * Summary.ref behaves like ref, but also registers a summary to Coq. + *) +let counter = Summary.ref ~name:"counter" 0 + +(* + * We can increment our counter: + *) +let increment () = + counter := succ !counter + +(* + * We can also read the value of our counter: + *) +let value () = + !counter |
