Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for FSharp BCL List deserialization #932

Closed
MrLuje opened this issue Jun 16, 2024 · 0 comments · Fixed by #935
Closed

Support for FSharp BCL List deserialization #932

MrLuje opened this issue Jun 16, 2024 · 0 comments · Fixed by #935

Comments

@MrLuje
Copy link
Contributor

MrLuje commented Jun 16, 2024

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant