iterate on booleans

This commit is contained in:
Simon Cruanes 2015-08-11 19:09:59 +02:00
parent 3ab300eea6
commit 80e9057a00
2 changed files with 6 additions and 0 deletions

View file

@ -578,6 +578,8 @@ let int_range ~start ~stop k =
let int_range_dec ~start ~stop k =
for i = start downto stop do k i done
let bools k = k false; k true
let of_set (type s) (type v) m set =
let module S = (val m : Set.S with type t = s and type elt = v) in
fun k -> S.iter k set

View file

@ -422,6 +422,10 @@ val int_range_dec : start:int -> stop:int -> int t
(** Iterator on decreasing integers in [stop...start] by steps -1.
See {!(--^)} for an infix version *)
val bools : bool t
(** Iterates on [true] and [false]
@since NEXT_RELEASE *)
val of_set : (module Set.S with type elt = 'a and type t = 'b) -> 'b -> 'a t
(** Convert the given set to a sequence. The set module must be provided. *)