My effect algebra for a Run datatype looks something like this:
data Thing a
= Async (Array Int) (Aff (...) a)
| Alt a a
I want to implement non-deterministic choice for this but I’m stuck. The implementation for Alt should race the two Affs but also concat the arrays (could probably have ParAff there directly instead of Aff). I looked at the Choose effect type but it seems it doesn’t allow me to peel off the layers and have access to all the data in the algebra. That is I don’t have direct access to the array and Aff – it only allows me to interpret the data into some other datatype with an Alt instance.
I thought that by adding the Alt case into my own algebra (instead of using the Choose algebra) would allow me to accomplish what I’m doing, and maybe it does – but I would need to peel off both of the sides at the same time when interpreting and I’m not sure how to do that.
The benefit of using the built-in Choose would be that I could use the Alt instance.