diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/iStream.ml | 6 | ||||
| -rw-r--r-- | lib/iStream.mli | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/lib/iStream.ml b/lib/iStream.ml index 65a336dafd..1d9f55998e 100644 --- a/lib/iStream.ml +++ b/lib/iStream.ml @@ -6,11 +6,11 @@ (* * GNU Lesser General Public License Version 2.1 *) (************************************************************************) -type ('a,'r) peek = +type ('a,'r) u = | Nil | Cons of 'a * 'r -type 'a node = ('a,'a t) peek +type 'a node = ('a,'a t) u and 'a t = 'a node Lazy.t @@ -18,7 +18,7 @@ let empty = Lazy.lazy_from_val Nil let cons x s = Lazy.lazy_from_val (Cons (x, s)) -let thunk s = lazy (Lazy.force (Lazy.force s)) +let thunk = Lazy.lazy_from_fun let rec force s = match Lazy.force s with | Nil -> () diff --git a/lib/iStream.mli b/lib/iStream.mli index fd3fa6c503..9e4dec415a 100644 --- a/lib/iStream.mli +++ b/lib/iStream.mli @@ -15,6 +15,11 @@ type +'a t (** Type of pure streams. *) +type ('a,'r) u = +| Nil +| Cons of 'a * 'r +(** View type to decompose and build streams. *) + (** {6 Constructors} *) val empty : 'a t @@ -23,7 +28,7 @@ val empty : 'a t val cons : 'a -> 'a t -> 'a t (** Append an element in front of a stream. *) -val thunk : 'a t Lazy.t -> 'a t +val thunk : (unit -> ('a,'a t) u) -> 'a t (** Internalize the lazyness of a stream. *) (** {6 Destructors} *) @@ -31,12 +36,7 @@ val thunk : 'a t Lazy.t -> 'a t val is_empty : 'a t -> bool (** Whethere a stream is empty. *) -type ('a,'r) peek = -| Nil -| Cons of 'a * 'r -(** View type for {!peek} *) - -val peek : 'a t -> ('a , 'a t) peek +val peek : 'a t -> ('a , 'a t) u (** Return the head and the tail of a stream, if any. *) (** {6 Standard operations} |
