diff options
| author | ppedrot | 2013-08-08 12:28:17 +0000 |
|---|---|---|
| committer | ppedrot | 2013-08-08 12:28:17 +0000 |
| commit | f0a83ebe0cb8d1a4815ce551cdca66f13a93c72e (patch) | |
| tree | 605a87dbc501e431487d8a504d91f05db365e1ee /lib | |
| parent | 1f80821a8d3586933201d7094b32f06d29e444d3 (diff) | |
Small fix in IStream interface.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16667 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/iStream.ml | 10 | ||||
| -rw-r--r-- | lib/iStream.mli | 7 |
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/iStream.ml b/lib/iStream.ml index 33424b6e44..64cbb5807e 100644 --- a/lib/iStream.ml +++ b/lib/iStream.ml @@ -12,9 +12,13 @@ type 'a node = and 'a t = 'a node Lazy.t -let empty = Lazy.lazy_from_val Nil +let lift (n : 'a node) : 'a t = Obj.magic n +(** Small hack to overcome a missing optimization in OCaml compilation of lazy + values. *) -let cons x s = Lazy.lazy_from_val (Cons (x, s)) +let empty = lift Nil + +let cons x s = lift (Cons (x, s)) let thunk s = lazy (Lazy.force (Lazy.force s)) @@ -76,5 +80,3 @@ let rec concat_node = function and concat (s : 'a t t) = thunk (lazy (concat_node (Lazy.force s))) - -let lempty = empty diff --git a/lib/iStream.mli b/lib/iStream.mli index 2fcc92675a..caae0ad35a 100644 --- a/lib/iStream.mli +++ b/lib/iStream.mli @@ -36,9 +36,7 @@ val peek : 'a t -> ('a * 'a t) option (** {6 Standard operations} - The complexity of stream-returning functions depends on the lazy status of the - actual content of the stream, i.e. a lazy stream will be processed lazily. - Other functions are eager. *) + All stream-returning functions are lazy. The other ones are eager. *) val app : 'a t -> 'a t -> 'a t (** Append two streams. Not tail-rec. *) @@ -70,6 +68,3 @@ val to_list : 'a t -> 'a list val force : 'a t -> 'a t (** Forces the whole stream. *) - -val lempty : 'a t -(** Lazy empty stream. *) |
