fjoppe / Legivel

F# Yaml 1.2 parser
https://fjoppe.github.io/Legivel
The Unlicense
60 stars 5 forks source link

A yaml type provider based on this ? #37

Open jkone27 opened 2 years ago

jkone27 commented 2 years ago

Idea for a yaml type provider

This old type provider to read yaml is not usable anymore.. https://fsprojects.github.io/FSharp.Configuration/YamlConfigProvider.html

could be handful to have an independent yaml type provider working cross platform on NET5+

just an idea

fjoppe commented 2 years ago

Thanks. I've played with this idea. The complexity with yaml is freedom - ie the key in a mapping, can be a mapping itself. And even if you make an "opiniated" version, which supports a subset of yaml, I still need to work out standard patterns which convert input to either Discriminated Unions, or records with nested properties. To be honest, I haven't put effort into this.

jkone27 commented 2 years ago

maybe recursive types could be used ("the key in a mapping, can be a mapping itself") like in trees etc..? Probably FSharp.Data JsonValue also uses something similar.. e.g. JsonValue in FSharp.Data (used in JsonProvider): https://github.com/fsprojects/FSharp.Data/blob/main/src/Json/JsonValue.fs#L39-39