diff options
Diffstat (limited to 'lib/Utilities.ml')
| -rw-r--r-- | lib/Utilities.ml | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Utilities.ml b/lib/Utilities.ml index dcf4417..6f27b30 100644 --- a/lib/Utilities.ml +++ b/lib/Utilities.ml @@ -55,7 +55,7 @@ module List = struct include Generic (ListSequence) - let concat_map f xs = List.map f xs |> sequence |> Stdlib.Result.map List.concat + let concat_mapm f xs = List.map f xs |> sequence |> Stdlib.Result.map List.concat let hd_opt = function x :: _ -> Some x | [] -> None end @@ -93,6 +93,8 @@ module FingerTree = struct match f elem with None -> acc | Some result -> BatFingerTree.snoc acc result) BatFingerTree.empty + let concat_mapm f xs = BatFingerTree.map f xs |> sequence |> Stdlib.Result.map BatFingerTree.append + let concat_map f = BatFingerTree.fold_left (fun acc elem -> BatFingerTree.append acc @@ f elem) BatFingerTree.empty |
