magnolia icon indicating copy to clipboard operation
magnolia copied to clipboard

Is my data recursive?

Open joroKr21 opened this issue 8 years ago • 1 comments

I have a type class Schema[A] and two variants: FlatSchema[A] and RecursiveSchema[A] with the obvious semantics. Except that FlatSchema is more efficient and supports more operations. Can I make the choice based on A being recursive or not? I don't think it's currently possible. I guess one way would be to have a separate type class Recursive[A] (assuming #46) but its implementation would essentially duplicate Schema. Besides, it would be nice to have a built in way of knowing.

joroKr21 avatar Nov 30 '17 01:11 joroKr21

This is something that could potentially be added with #46. The methods described in that feature (e.g. param or caseClass) can be defined with any number of parameters selected from a predefined list of names that Magnolia would support, and the code will be generated as necessary to provide those parameters (the macro inspects the method signature). It should be no problem to support an additional boolean parameter which makes this distinction.

propensive avatar Nov 30 '17 20:11 propensive