diff options
| author | Enrico Tassi | 2019-06-17 13:36:47 +0200 |
|---|---|---|
| committer | Enrico Tassi | 2019-06-17 13:36:47 +0200 |
| commit | 658db3a8b75a338df6b07d0f0e5034bb81bcfd16 (patch) | |
| tree | e63e0c217ed75e4a8bafcf6c30d7cf5a1bcf0a61 /doc/plugin_tutorial/tuto2/src/counter.ml | |
| parent | 5d18dfed8e68dd964bca5d64ca6bdd9f8ffbb1df (diff) | |
| parent | 2f5fefcd76259d5e0aee5ef5076ae4c4dd662ec1 (diff) | |
Merge PR #10368: Update, expand, and document plugin tutorial 2
Ack-by: SkySkimmer
Reviewed-by: gares
Ack-by: tlringer
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 |
