Skip to content

Commit 7dec159

Browse files
committed
Composition of effects function added
1 parent d8aed11 commit 7dec159

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Effect.v

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@
22
Record t := New {
33
command : Type;
44
answer : command -> Type }.
5+
6+
(** The composition of two effects. *)
7+
Definition compose (E1 E2 : t) : t :=
8+
New (command E1 + command E2) (fun c =>
9+
match c with
10+
| inl c1 => answer E1 c1
11+
| inr c2 => answer E2 c2
12+
end).

0 commit comments

Comments
 (0)