Tracking changes on compiler side
klntsky opened this issue · 2 comments
This issue is to track changes in the PureScript compiler that affect docs.json format and may break things for us.
I think in the future we can parametrize our DocsJson type by a row of types corresponding to docs.json parts that differ for various versions of purs.
And then we'll have DecodeJson instances for each of the versions - it will not require duplicating much code, we'll just use DecodeJson instances for these tiny differing parts.
The idea above was inspired by the awesome "Trees That Grow" paper.
It shows how to define many variants of large ADTs that differ only in some of the constructors, with the use of type families.
We don't have type families in PS, but I believe rows can be a replacement for them when applying this technique.
UPD: Wrong, looks like I had a misconception about what can be done with row types.
Anyways, multiple type parameters will do the trick just fine.