I have the following code:
let f g x = if x < 0 then None else Some(g x)
Along with f
the g
function may or may not return Option
as well. Since f
has it as generic and doesn't have any generic constraints I can end up having Some(Some(z))
as a result. If fact all I want is either None
or Some(z)
. How can I avoid double wrapping (preferably without imposing constraints on g
)?