Answer to http://disq.us/p/1za4u75.
Hi, your problem is actually quite hard to solve with composition, at least without a profunctor-based approach, which is really hard to do in Swift due to the lack of higher-kinded types.
There is a solution, though, but we must be clear about what we're searching for here. In your
ViewState<T> there could be no
Prism that points just to
T, because the
inject function wouldn't know what
case to produce with a value of type
T: it's probably going to be an
At the bottom of this answer you'll find all the code needed to implement it: it can be directly copy-pasted into a playground.