Simplify some Result.List.all
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
b41f132fb0
commit
68f4147869
|
@ -66,19 +66,17 @@ module Backend = struct
|
|||
{ info
|
||||
; lib
|
||||
; runner_libraries =
|
||||
Result.List.all (List.map info.runner_libraries ~f:resolve)
|
||||
Result.List.map info.runner_libraries ~f:resolve
|
||||
; extends =
|
||||
let open Result.O in
|
||||
Result.List.all
|
||||
(List.map info.extends
|
||||
~f:(fun ((loc, name) as x) ->
|
||||
Result.List.map info.extends ~f:(fun ((loc, name) as x) ->
|
||||
resolve x >>= fun lib ->
|
||||
match get ~loc lib with
|
||||
| None ->
|
||||
Error (Errors.exnf loc "%S is not an %s"
|
||||
(Lib_name.to_string name)
|
||||
(desc ~plural:false))
|
||||
| Some t -> Ok t))
|
||||
| Some t -> Ok t)
|
||||
}
|
||||
|
||||
let dgen t =
|
||||
|
@ -190,9 +188,7 @@ include Sub_system.Register_end_point(
|
|||
>>= fun libs ->
|
||||
Lib.DB.find_many (Scope.libs scope) [Dune_file.Library.best_name lib]
|
||||
>>= fun lib ->
|
||||
Result.List.all
|
||||
(List.map info.libraries
|
||||
~f:(Lib.DB.resolve (Scope.libs scope)))
|
||||
Result.List.map info.libraries ~f:(Lib.DB.resolve (Scope.libs scope))
|
||||
>>= fun more_libs ->
|
||||
Lib.closure (lib @ libs @ more_libs)
|
||||
in
|
||||
|
|
|
@ -87,16 +87,14 @@ module Driver = struct
|
|||
; lib = lazy lib
|
||||
; replaces =
|
||||
let open Result.O in
|
||||
Result.List.all
|
||||
(List.map info.replaces
|
||||
~f:(fun ((loc, name) as x) ->
|
||||
Result.List.map info.replaces ~f:(fun ((loc, name) as x) ->
|
||||
resolve x >>= fun lib ->
|
||||
match get ~loc lib with
|
||||
| None ->
|
||||
Error (Errors.exnf loc "%a is not a %s"
|
||||
Lib_name.pp_quoted name
|
||||
(desc ~plural:false))
|
||||
| Some t -> Ok t))
|
||||
| Some t -> Ok t)
|
||||
}
|
||||
|
||||
let dgen t =
|
||||
|
|
|
@ -133,7 +133,7 @@ module Register_end_point(M : End_point) = struct
|
|||
(match M.Info.backends info with
|
||||
| None -> Ok None
|
||||
| Some l ->
|
||||
Result.List.all (List.map l ~f:(M.Backend.resolve (Scope.libs c.scope)))
|
||||
Result.List.map l ~f:(M.Backend.resolve (Scope.libs c.scope))
|
||||
>>| Option.some)
|
||||
>>= fun written_by_user ->
|
||||
M.Backend.Selection_error.or_exn ~loc:(M.Info.loc info)
|
||||
|
|
Loading…
Reference in New Issue