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 =
|
||||
Common.t ~profile >>= fun base ->
|
||||
field "switch" string >>= fun switch ->
|
||||
let%map name = field "name" Name.t ~default:switch
|
||||
let%map base = Common.t ~profile
|
||||
and switch = field "switch" string
|
||||
and name = field_o "name" Name.t
|
||||
and root = field_o "root" string
|
||||
and merlin = field_b "merlin"
|
||||
in
|
||||
let name = Option.value ~default:switch name in
|
||||
let base = { base with targets = Target.add base.targets x } in
|
||||
{ base
|
||||
; switch
|
||||
|
|
Loading…
Reference in New Issue