wip: add to_std_seq

see #254
This commit is contained in:
Simon Cruanes 2019-11-20 17:50:40 -06:00
parent 78ef007b77
commit 7d1862a501
4 changed files with 56 additions and 31 deletions

View file

@ -13,6 +13,7 @@ depends: [
"dune"
"result"
"uchar"
"seq"
"qtest" { with-test }
"qcheck" { with-test }
"ounit" { with-test }

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Options} *)
@ -210,6 +209,10 @@ let to_iter o k = match o with
let to_seq = to_iter
let to_std_seq o () = match o with
| None -> Seq.Nil
| Some x -> Seq.Cons (x, Seq.empty)
let pp ppx out = function
| None -> Format.pp_print_string out "None"
| Some x -> Format.fprintf out "@[Some %a@]" ppx x

View file

@ -1,4 +1,3 @@
(* This file is free software, part of containers. See file "license" for more details. *)
(** {1 Options} *)
@ -187,6 +186,10 @@ val choice_seq : 'a t sequence -> 'a t
val to_gen : 'a t -> 'a gen
val to_std_seq : 'a t -> 'a Seq.t
(** Same as {!Stdlib.Option.to_seq}
@since NEXT_RELEASE *)
val to_iter : 'a t -> 'a sequence
(** Returns an internal iterator, like in the library [Iter].
@since NEXT_RELEASE *)

View file

@ -1,44 +1,62 @@
(alias
(name unlabel)
(deps (:mli CCArrayLabels.mli) ../unlabel.exe)
(action (run ../unlabel.exe %{mli} CCArray.mli)))
(name unlabel)
(deps
(:mli CCArrayLabels.mli)
../unlabel.exe)
(action
(run ../unlabel.exe %{mli} CCArray.mli)))
(alias
(name unlabel)
(deps (:mli CCArray_sliceLabels.mli) ../unlabel.exe)
(action (run ../unlabel.exe %{mli} CCArray_slice.mli)))
(name unlabel)
(deps
(:mli CCArray_sliceLabels.mli)
../unlabel.exe)
(action
(run ../unlabel.exe %{mli} CCArray_slice.mli)))
(alias
(name unlabel)
(deps (:mli CCEqualLabels.mli) ../unlabel.exe)
(action (run ../unlabel.exe %{mli} CCEqual.mli)))
(name unlabel)
(deps
(:mli CCEqualLabels.mli)
../unlabel.exe)
(action
(run ../unlabel.exe %{mli} CCEqual.mli)))
(alias
(name unlabel)
(deps (:mli CCListLabels.mli) ../unlabel.exe)
(action (run ../unlabel.exe %{mli} CCList.mli)))
(name unlabel)
(deps
(:mli CCListLabels.mli)
../unlabel.exe)
(action
(run ../unlabel.exe %{mli} CCList.mli)))
(alias
(name unlabel)
(deps (:mli CCStringLabels.mli) ../unlabel.exe)
(action (run ../unlabel.exe %{mli} CCString.mli)))
(name unlabel)
(deps
(:mli CCStringLabels.mli)
../unlabel.exe)
(action
(run ../unlabel.exe %{mli} CCString.mli)))
(executable
(name mkshims)
(modules mkshims)
(libraries dune.configurator))
(name mkshims)
(modules mkshims)
(libraries dune.configurator))
(rule
(targets CCShims_.ml CCShimsList_.ml CCShimsFun_.ml CCShimsFun_.mli CCShimsArray_.ml CCShimsFormat_.ml)
(deps ./mkshims.exe)
(action (run ./mkshims.exe)))
(targets CCShims_.ml CCShimsList_.ml CCShimsFun_.ml CCShimsFun_.mli
CCShimsArray_.ml CCShimsFormat_.ml)
(deps ./mkshims.exe)
(action
(run ./mkshims.exe)))
(library
(name containers)
(public_name containers)
(wrapped false)
(modules :standard \ mkshims)
(flags :standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -nolabels -open CCMonomorphic)
(ocamlopt_flags (:include ../flambda.flags))
(libraries result uchar containers.monomorphic))
(name containers)
(public_name containers)
(wrapped false)
(modules :standard \ mkshims)
(flags :standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -nolabels -open
CCMonomorphic)
(ocamlopt_flags
(:include ../flambda.flags))
(libraries result uchar seq containers.monomorphic))