Is it possible to decode sum types in such a way that there is no tag field, no content field, to be able to parse sum types from json that are coming from a Rust server using encoding (with default serde settings*)?
Here is an example:
print(PossibleValues::NumberValue(NumberValueRecord { a: 123, b: 42 }));
print(PossibleValues::StringValue(StringValueRecord { a: 123, b: "asd".to_string() }));
print(PossibleValues::Empty);
serialized = {"NumberValue":{"a":123,"b":42}}
serialized = {"StringValue":{"a":123,"b":"asd"}}
serialized = "Empty"
There is no tag or content field. I think I need ObjectWithSingleField but nullary constructors shouldn't be { "foo": [] } but "foo" (flattenContentsArray = true), is that combination possible in PureScript waterslide with automatic/generic deserialization?
*The API can't be changed anymore on the server-side because many apps and services already depend on it.
Is it possible to decode sum types in such a way that there is no tag field, no content field, to be able to parse sum types from json that are coming from a Rust server using encoding (with default serde settings*)?
Here is an example:
There is no
tagorcontentfield. I think I needObjectWithSingleFieldbut nullary constructors shouldn't be{ "foo": [] }but"foo"(flattenContentsArray = true), is that combination possible in PureScript waterslide with automatic/generic deserialization?*The API can't be changed anymore on the server-side because many apps and services already depend on it.