-
-
Save zwilias/390e4ddc0eba0e8197bd5295f4aacca2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var leafDecoder = map2(Leaf, field('name', string), field('value', int)); | |
var branchDecoder = map2( | |
Branch, | |
field('name', string), | |
field('children', list(decoder)) | |
); | |
var decoder = oneOf([ | |
lazy(function (_) { return branchDecoder; }), | |
leafDecoder | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment