YamlDotNet
YamlDotNet copied to clipboard
Support for FSharp BCL List deserialization
While looking at #913, I noticed that there is currently no support for F# List.
In F# BCL, there is basically 3 main collections :
-
seq
(= C# IEnumerable) -
array
(= C# Array) -
list
which is an ordered immutable list
#r "nuget: YamlDotNet"
open YamlDotNet
[<CLIMutable>]
type MyType = {
Numbers: int list
}
open YamlDotNet.Serialization
let d = Deserializer()
"""
Numbers: [1, 2, 3]
"""
|> d.Deserialize<MyType>
|> printfn "%A"
gives the following error :
(Line: 2, Col: 10, Idx: 10) - (Line: 2, Col: 10, Idx: 10): No node deserializer was able to deserialize the node into type Microsoft.FSharp.Collections.FSharpList`1[[System.Int32, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], FSharp.Core, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Stopped due to error
If that's ok, I can add support for it, following the same approach as #930 (probably by adding a new deserializer in DeserializerBuilder
)