I need to create a mutable option<T>
type in F#. I've tried writing
let x = ref None
and subsequently writing
x := Some(z)
but it doesn't work. Help!
You need to state the type explicitly to avoid "the Value Restriction" (or see "Automatic Generalization" on msdn):
let x : Ref<int option> = ref None
x := Some 4