Workspace.Context.Opam: parse name to an option
This makes it possible to parse it using the applicative API. Signed-off-by: Etienne Millon <me@emillon.org>
This commit is contained in:
parent
282c0b3c41
commit
d9e7f54277
|
@ -76,12 +76,13 @@ module Context = struct
|
||||||
}
|
}
|
||||||
|
|
||||||
let t ~profile ~x =
|
let t ~profile ~x =
|
||||||
Common.t ~profile >>= fun base ->
|
let%map base = Common.t ~profile
|
||||||
field "switch" string >>= fun switch ->
|
and switch = field "switch" string
|
||||||
let%map name = field "name" Name.t ~default:switch
|
and name = field_o "name" Name.t
|
||||||
and root = field_o "root" string
|
and root = field_o "root" string
|
||||||
and merlin = field_b "merlin"
|
and merlin = field_b "merlin"
|
||||||
in
|
in
|
||||||
|
let name = Option.value ~default:switch name in
|
||||||
let base = { base with targets = Target.add base.targets x } in
|
let base = { base with targets = Target.add base.targets x } in
|
||||||
{ base
|
{ base
|
||||||
; switch
|
; switch
|
||||||
|
|
Loading…
Reference in New Issue