What do you think of a lens to operate on a subset of fields:
multifocus :: Functor f => proxy r -> (Rec u -> f (Rec v)) -> Rec (u :++ r) -> f (Rec (v :++ r))
Ideally I expected multifocus = const unsafeCoerce but this breaks if the user creates a new record Rec v "from scratch" instead of using the Rec u provided by the lens.
For instance, it might be useful to resolve this Motor issue. And more generally this may help alleviate some problems with row-polymorphism due to the fact that it isn't obvious to GHC that adding a field then removing it always results in a record of the same type as the one we started with.
What do you think of a lens to operate on a subset of fields:
Ideally I expected
multifocus = const unsafeCoercebut this breaks if the user creates a new recordRec v"from scratch" instead of using theRec uprovided by the lens.For instance, it might be useful to resolve this Motor issue. And more generally this may help alleviate some problems with row-polymorphism due to the fact that it isn't obvious to GHC that adding a field then removing it always results in a record of the same type as the one we started with.