Hard to figure out recursive iteration
pkese opened this issue · comments
Peter Keše commented
I've been trying to figure out how I could write some code to iterate over a parsed .yaml document and it is really hard to understand anything without any documentation...
Could someone please write a piece of code like below and attach it to main README.md
(or at least provide a pointer to a test case doing something alike).
let yamlSerializer = SharpYaml.Serialization.Serializer ()
use yamlFile = File.OpenText "test.yaml"
let yamlDoc = yamlSerializer.Deserialize yamlFile
let rec recurseYaml yaml =
yamlDoc
|> Seq.iter (fun (key, value) ->
match value with
| DictionaryValueType d -> recurseYaml d
| ArrayValueType a -> printfn "%s: %A"
| StringValueType s -> printfn "%s: %s" key s
| IntValueType i -> printfn "%s: %d" key i
...
recurseYaml yamlDoc
Peter Keše commented
Sorry, please ignore