We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5991cd4 commit 7473a59Copy full SHA for 7473a59
atdgen-runtime/src/util.ml
@@ -84,6 +84,12 @@ struct
84
in
85
input_file fname (fun ic -> from_channel ?buf ~fname:fname0 ?lnum read ic)
86
87
+ (* seq_unfold is Seq.unfold, needed for ocaml < 4.11 *)
88
+ let rec seq_unfold f u () =
89
+ match f u with
90
+ | None -> Seq.Nil
91
+ | Some (x, u') -> Seq.Cons (x, seq_unfold f u')
92
+
93
let seq_from_lexbuf ?(fin = fun () -> ()) read ls lexbuf =
94
let f () =
95
try
@@ -97,7 +103,8 @@ struct
97
103
(try fin () with _ -> ());
98
104
raise e
99
105
100
- Seq.unfold f ()
106
+ (* Seq.unfold is only available from ocaml 4.11 *)
107
+ seq_unfold f ()
101
108
102
109
let seq_from_string ?buf ?fin ?fname ?lnum read ic =
110
let lexbuf = Lexing.from_string ic in
0 commit comments