Your code works (apart from the printf
). Maybe check your F# or .NET (Core) version. The Collections namespace doesn’t have to be open.
let testMap = Map.empty.Add("test", true).Add("otherTest", false)
let newTestMap =
testMap
|> Map.change // Here's the error!
"otherTest"
(fun v ->
match v with
| Some b -> Some (not b)
| None -> None )
printf "%A" newTestMap // map [("otherTest", true); ("test", true)]val it : unit = ()
CLICK HERE to find out more related problems solutions.