@@ -160,9 +160,10 @@ Definition subst {E : Type -> Type} {T U : Type} (k : T -> itree E U)
160160 | VisF e h => Vis e (fun x => _subst (h x))
161161 end .
162162
163- Definition bind {E : Type -> Type } {T U : Type } (u : itree E T) (k : T -> itree E U)
164- : itree E U :=
165- subst k u.
163+ Notation bind u k := (subst k u).
164+ (* Definition bind {E : Type -> Type} {T U : Type} (u : itree E T) (k : T -> itree E U) *)
165+ (* : itree E U := *)
166+ (* subst k u. *)
166167
167168(** Monadic composition of continuations (i.e., Kleisli composition).
168169 *)
@@ -221,7 +222,7 @@ Ltac fold_subst :=
221222 repeat (change (ITree.subst ?k ?t) with (ITree.bind t k)).
222223
223224Ltac fold_monad :=
224- repeat (change (@ITree.bind ?E) with (@mbind (itree E) _));
225+ repeat (change (@ITree.subst ?E) with (@mbind (itree E) _));
225226 repeat (change (go (@RetF ?E _ _ _ ?r)) with (@mret (itree E) _ _ r));
226227 repeat (change (@ITree.map ?E) with (@fmap (itree E) _)).
227228
@@ -239,11 +240,11 @@ End ITree.
239240 *)
240241
241242Module ITreeNotations.
242- Notation "t1 ≫= k2" := (ITree.bind t1 k2 ) : itree_scope.
243- Notation "x ← t1 ; t2" := (ITree.bind t1 (fun x => t2)) : itree_scope.
244- Notation "t1 ;; t2" := (ITree.bind t1 (fun _ => t2)) : itree_scope.
243+ Notation "t1 ≫= k2" := (ITree.subst k2 t1 ) : itree_scope.
244+ Notation "x ← t1 ; t2" := (ITree.subst (fun x => t2) t1 ) : itree_scope.
245+ Notation "t1 ;; t2" := (ITree.subst (fun _ => t2) t1 ) : itree_scope.
245246Notation "' p ← t1 ; t2" :=
246- (ITree.bind t1 (fun x_ => match x_ with p => t2 end ))
247+ (ITree.subst (fun x_ => match x_ with p => t2 end ) t1 )
247248 (at level 20, p pattern , t1 at level 100, t2 at level 200, only parsing) : itree_scope.
248249Infix ">=>" := ITree.cat (at level 60, right associativity) : itree_scope.
249250End ITreeNotations.
0 commit comments