xyncro / chiron

JSON for F#
https://xyncro.tech/chiron
MIT License
175 stars 41 forks source link

Sample choice operator? #15

Closed haf closed 9 years ago

haf commented 9 years ago

Another sample I'd like to see in the code base, let's say I have:

{ "entity": 45 }

OR

{ "entity": "SEK" }

And I want to match based on whether it's a string or a number; how would I do that best in FromJson?

kolektiv commented 9 years ago

I think those operators are pretty reasonable and non-clashy. I'll try and come up with a suitable location for them!

kolektiv commented 9 years ago

I've omitted these from PR #30 for now as they were only used within the lib in the decimal question (which I've reverted for now, see #22). However, I think they do lead on to a good potential set of combinators, so I'm going to create a branch for experimenting with that concept and move them in to there where we can experiment with what a full set of potential combinators for chaining errors/alternatives, etc. through might look like. Would love your input and thoughts @haf!

haf commented 9 years ago

Ping me in the PR thread when you've started.