Commits

camlspotter committed 2c9dad9

regexp?

Comments (0)

Files changed (2)

       | R.Ok (Some v, st) -> R.Ok (v, st)
       | R.Error e -> R.Error e
 
+  let rec (<*>) : 'a list t -> 'a list t -> 'a list t = fun c1 c2 ->
+    (c1 >>= fun x -> (c1 <*> c2) >>= fun y -> return (x @ y)) <|> c2
+        
+  let rec (<+>) : 'a list t -> 'a list t -> 'a list t = fun c1 c2 ->
+    c1 >>= fun x -> (c1 <*> c2) >>= fun y -> return (x @ y)
+
+  let rec (<?>) : 'a list t -> 'a list t -> 'a list t = fun c1 c2 ->
+    (c1 >>= fun x -> c2 >>= fun y -> return (x @ y)) <|> c2
+
   let catch : 'a t -> 'a R.t t = fun c st ->
     match c st with
     | R.Ok (res, st) -> R.Ok (R.Ok res, st)
   val ( <||> ) : 'a option t -> 'a option t -> 'a option t
   val ( <|>> ) : 'a option t -> 'a t -> 'a t
 
+  val ( <*> ) : 'a list t -> 'a list t -> 'a list t
+  val ( <+> ) : 'a list t -> 'a list t -> 'a list t
+  val ( <?> ) : 'a list t -> 'a list t -> 'a list t
+
   (* val ignore : 'a t -> unit t *)
   val catch : 'a t -> 'a Result.t t
   val catch_opt : 'a t -> 'a option t