File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -266,21 +266,18 @@ struct
266266 let reflect (m : ('a * 'o, 'e) list_view ) =
267267 { iolist = fun s0 nil cons -> reflect0 m nil cons }
268268
269- let split m : (_ result, _, _, _) t =
270- let rnil e = Nil e in
271- let rcons p s l = Cons ((p, s), l) in
272- { iolist = fun s nil cons ->
273- begin match m.iolist s rnil rcons with
274- | Nil e -> cons (Error e) s nil
275- | Cons ((x , s ), l ) ->
276- let l e = reflect (l e) in
277- cons (Ok (x, l)) s nil
278- end }
279-
280269 let run m s =
281270 let rnil e = Nil e in
282271 let rcons x s l = Cons ((x, s), l) in
283272 m.iolist s rnil rcons
273+
274+ let split m : (_ result, _, _, _) t =
275+ get >> = fun s -> match run m s with
276+ | Nil e -> return (Error e)
277+ | Cons ((x , s ), l ) ->
278+ let l e = reflect (l e) in
279+ set s >> return (Ok (x, l))
280+
284281end
285282
286283module type Param = sig
You can’t perform that action at this time.
0 commit comments