Ppx_spice supports the latest compiler v11-rc.4 now

You can try with 0.2.1-rc.0

13 Likes

It looks really great. I was wondering if spice supports inline records in variants (something that decco didn’t support, and because the decoupling of the record and variants could make code less readable)

I’m afraid to say it doesn’t support yet. Actually, one of motivation to fork the decco was how to parse json data to variant. The json data formed to array could be parsed to the variant with decco. motivation

Anyway can you show me some sample json format that you want to represent the variant with inline record?

I think very similar to how it’s being encoded in ReScript (object with a tag) would be fine.

type t = A | B({b: string})
// json values
"A"
{
   "TAG":"B",
   "b":"b"
}

Is this right?

Yes! To be honest I don’t care too much about how it’s encoded as long as it’s consistent and safe :slight_smile:

1 Like