Permalink
Browse files

fix_b

  • Loading branch information...
1 parent 6bac3c7 commit 40731df6187f7d0541e28020edd974037f3bb2a0 Jake Donham committed Apr 22, 2010
Showing with 14 additions and 3 deletions.
  1. +8 −0 src/froc/froc.ml
  2. +6 −3 src/froc/froc.mli
View
@@ -196,6 +196,14 @@ let notify_result_b_cancel = notify_result_cancel
let hash_behavior = hash
+let fix_b ?eq bf =
+ let bt, bu = make_changeable ?eq () in
+ begin
+ try connect bu (bf bt)
+ with e -> write_exn bu e
+ end;
+ bt
+
let join_b ?eq bb = bind ?eq bb (fun b -> b)
let switch ?eq b e =
View
@@ -128,6 +128,12 @@ val try_bind_lift : ?eq:('b -> 'b -> bool) -> (unit -> 'a behavior) -> ('a -> 'b
more efficient.
*)
+val join_b : ?eq:('a -> 'a -> bool) -> 'a behavior behavior -> 'a behavior
+ (** [join_b b] behaves as whichever behavior is currently the value of [b]. *)
+
+val fix_b : ?eq:('a -> 'a -> bool) -> ('a behavior -> 'a behavior) -> 'a behavior
+ (** [fix_b f] returns the fixpoint of [f]. *)
+
val read : 'a behavior -> 'a
(**
@@ -286,9 +292,6 @@ val hash_event : 'a event -> int
(** {2 Derived operations} *)
-val join_b : ?eq:('a -> 'a -> bool) -> 'a behavior behavior -> 'a behavior
- (** [join_b b] behaves as whichever behavior is currently the value of [b]. *)
-
val switch : ?eq:('a -> 'a -> bool) -> 'a behavior -> 'a behavior event -> 'a behavior
(** [switch b e] behaves as [b] until [e] fires, then behaves as the last value of [e]. *)

0 comments on commit 40731df

Please sign in to comment.