include Seq in CCSeq for ocaml >= 4.07

This commit is contained in:
Fardale 2022-09-20 15:09:45 +02:00
parent a5f9f2b95d
commit 47ff9935dc
2 changed files with 16 additions and 0 deletions

View file

@ -6,9 +6,17 @@ type 'a equal = 'a -> 'a -> bool
type 'a ord = 'a -> 'a -> int type 'a ord = 'a -> 'a -> int
type 'a printer = Format.formatter -> 'a -> unit type 'a printer = Format.formatter -> 'a -> unit
[@@@ifge 4.07]
include Seq
[@@@else_]
type +'a t = unit -> 'a node type +'a t = unit -> 'a node
and +'a node = 'a Seq.node = Nil | Cons of 'a * 'a t and +'a node = 'a Seq.node = Nil | Cons of 'a * 'a t
[@@@endif]
let nil () = Nil let nil () = Nil
let cons a b () = Cons (a, b) let cons a b () = Cons (a, b)
let empty = nil let empty = nil

View file

@ -13,9 +13,17 @@ type 'a printer = Format.formatter -> 'a -> unit
(** {2 Basics} *) (** {2 Basics} *)
[@@@ifge 4.07]
include module type of Seq
[@@@else_]
type +'a t = unit -> 'a node type +'a t = unit -> 'a node
and +'a node = 'a Seq.node = Nil | Cons of 'a * 'a t and +'a node = 'a Seq.node = Nil | Cons of 'a * 'a t
[@@@endif]
val nil : 'a t val nil : 'a t
val empty : 'a t val empty : 'a t
val cons : 'a -> 'a t -> 'a t val cons : 'a -> 'a t -> 'a t