fsprojects / Fleece

Json mapper for F#
http://fsprojects.github.io/Fleece
Apache License 2.0
199 stars 31 forks source link

Make `jopt` generic to all types supporting Zero #124

Closed gusty closed 2 years ago

gusty commented 2 years ago

Until now jopt related combinators worked only with options.

With this PR we can make it work with voption, Nullable, lists and in general with any type which support the Zero operation.

While testing this I realized jopt has the same problem with recursion as jreq so it needs to call a lazy version. This wasn't evident as we didn't have a test with a recursive option value and the jopt combinator.