File: indexedstate.v

package info (click to toggle)
coq-ext-lib 0.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 808 kB
  • sloc: makefile: 44; python: 31; sh: 4; lisp: 3
file content (24 lines) | stat: -rw-r--r-- 506 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Require Import ExtLib.Data.Monads.IStateMonad.
Require Import ExtLib.Structures.IXMonad.

Section example.

  Import IxMonadNotation.
  Local Open Scope ixmonad_scope. 
        
  Variables A B C : Type.

  Variable function1 : A -> B.
  Variable function2 : B -> C.

  Definition update1 : istate A B unit :=
    modify_ function1.

  Definition update2 : istate B C unit :=
    modify_ function2.

  Definition compose : istate A C unit :=
    update1 ;;
    update2.

End example.