I’m wanting to implement a similar functionality to the parameters directive for my own API. I understand the Magnet pattern it uses, but what I haven’t figured out is how it takes a list of parameters and turns it into a tuple such that one can write:
At the implementation side, it takes the ‘left parameters directive’ which is a Directive that produces a value of ‘Type A’ (Directive[TA]). It then takes the ‘right parameter definition’ that, given a value of type P produces a Directive that produces values of ‘type B’ (Directive[TB]). Then it uses ‘normal’ directive composition & to combine these 2 directives together.
How this works at the type level is all a bit harder to explain (and I’m not sure I fully understand it myself), but this perhaps might be a starting point?