Welcome to the Functional Programming Zulip Chat Archive. You can join the chat here.
How would one go about writing JSON instances for the effect GADTs? My intention is to share these GADTs with the ghcjs frontend, and send the JSON blob directly from the frontend in order to have the backend effectuate the requested effect.
I suppose I could use aeson-gadt-th if I make m ~ Identity
m ~ Identity
That m is Sem r when being used, we mostly just avoid cyclic dependency on r in types this way - that's not problem for first-order effects (where m is phantom), but for higher-order effects you would have to make sure m as it carries have m matching with Sem r on the other side
That is, if your effects are first-order, Identity should work - but otherwise it won't
are you using polysemy in the frontend?
Only in the backend, but I'm thinking of using the non-monadic GADT type in the frontend. (so makeSem would create orphan instances in the backend)
This is all in the context of obelisk prerendering. I think it would be cool if in this otherwise SPA app (pulling DB data from xhr requests), the backend would prerender the DB data, for google juice.
So the polymorphic code when run from frontend would go via xhr, but when run from backend (during prerendering) would talk directly to the database. The "API" is captured by a polysemy effect GADT.