Skip to content

Commit d04ed89

Browse files
committed
no optMap
1 parent b6ed169 commit d04ed89

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

analysis/src/FindFiles.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ let findDependencyFiles base config =
191191
let open Infix in
192192
let deps =
193193
config |> Json.get "bs-dependencies" |?> Json.array |? []
194-
|> optMap Json.string
194+
|> List.filter_map Json.string
195195
in
196196
let devDeps =
197197
config
198198
|> Json.get "bs-dev-dependencies"
199-
|?> Json.array |? [] |> optMap Json.string
199+
|?> Json.array |? [] |> List.filter_map Json.string
200200
in
201201
let deps = deps @ devDeps in
202202
Log.log ("Dependencies: " ^ String.concat " " deps);

analysis/src/Infix.ml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
1-
(**
2-
* This combines a filter and a map.
3-
* You provide a function that turns an element into an optional of another element,
4-
* and you get a list of all of the present results.
5-
*)
6-
let optMap : ('a -> 'b option) -> 'a list -> 'b list =
7-
fun fn items ->
8-
List.fold_left
9-
(fun result item ->
10-
match fn item with None -> result | Some res -> res :: result)
11-
[] items
12-
131
let ( |! ) o d = match o with None -> failwith d | Some v -> v
142

153
let ( |? ) o d = match o with None -> d | Some v -> v

0 commit comments

Comments
 (0)