From 47ff9935dc540395e41556a32ff948ba1213aaf7 Mon Sep 17 00:00:00 2001 From: Fardale Date: Tue, 20 Sep 2022 15:09:45 +0200 Subject: [PATCH] include Seq in CCSeq for ocaml >= 4.07 --- src/core/CCSeq.ml | 8 ++++++++ src/core/CCSeq.mli | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/core/CCSeq.ml b/src/core/CCSeq.ml index 0859f27a..b0747f4e 100644 --- a/src/core/CCSeq.ml +++ b/src/core/CCSeq.ml @@ -6,9 +6,17 @@ type 'a equal = 'a -> 'a -> bool type 'a ord = 'a -> 'a -> int type 'a printer = Format.formatter -> 'a -> unit +[@@@ifge 4.07] + +include Seq + +[@@@else_] + type +'a t = unit -> 'a node and +'a node = 'a Seq.node = Nil | Cons of 'a * 'a t +[@@@endif] + let nil () = Nil let cons a b () = Cons (a, b) let empty = nil diff --git a/src/core/CCSeq.mli b/src/core/CCSeq.mli index aa7b3e2b..bb6f0675 100644 --- a/src/core/CCSeq.mli +++ b/src/core/CCSeq.mli @@ -13,9 +13,17 @@ type 'a printer = Format.formatter -> 'a -> unit (** {2 Basics} *) +[@@@ifge 4.07] + +include module type of Seq + +[@@@else_] + type +'a t = unit -> 'a node and +'a node = 'a Seq.node = Nil | Cons of 'a * 'a t +[@@@endif] + val nil : 'a t val empty : 'a t val cons : 'a -> 'a t -> 'a t