diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-10-24 03:35:20 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-10-24 03:51:08 +0000 |
| commit | 8c2f0db7337328570af57461a3d95203537ac185 (patch) | |
| tree | df90400d4719ab5c04fb84530a8a3c0e2eae213e /lib/Utilities.ml | |
| parent | df6c0744dc4ebd164cd8a309eef5d2798b2d3e90 (diff) | |
| download | RNT-8c2f0db7337328570af57461a3d95203537ac185.tar.gz RNT-8c2f0db7337328570af57461a3d95203537ac185.zip | |
Use finger trees in more places
Diffstat (limited to '')
| -rw-r--r-- | lib/Utilities.ml | 6 | ||||
| -rw-r--r-- | lib/Utilities.mli | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/Utilities.ml b/lib/Utilities.ml index 6f27b30..0472038 100644 --- a/lib/Utilities.ml +++ b/lib/Utilities.ml @@ -93,11 +93,9 @@ 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 + let concat xss = BatFingerTree.fold_left BatFingerTree.append BatFingerTree.empty xss + let concat_mapm f xs = BatFingerTree.map f xs |> sequence |> Stdlib.Result.map concat end module Atomic = struct diff --git a/lib/Utilities.mli b/lib/Utilities.mli index 3f0787f..e748693 100644 --- a/lib/Utilities.mli +++ b/lib/Utilities.mli @@ -36,6 +36,7 @@ module FingerTree : sig val foldm_left : ('a -> 'b -> ('a, 'e) result) -> 'a -> 'b BatFingerTree.t -> ('a, 'e) result val join : string BatFingerTree.t -> string -> string val filter_map : ('a -> 'b option) -> 'a BatFingerTree.t -> 'b BatFingerTree.t + val concat : 'a BatFingerTree.t BatFingerTree.t -> 'a BatFingerTree.t val concat_mapm : ('a -> ('b BatFingerTree.t, 'e) result) -> 'a BatFingerTree.t -> ('b BatFingerTree.t, 'e) result end |
