[back]

All Some

Implement the function

val all_some : 'a option list -> 'a list option

which converts a list of options into an optional list according to the following specification.

Examples

let _ = assert (all_some [Some 1; Some 2; Some 3] = Some [1;2;3])
let _ = assert (all_some [Some 1; None; Some 3] = None)