On Fri, 4 Oct 2013 16:23:23 -0700, Charlie Paul <charli...@gmail.com> wrote: > Hello, > > I'm looking for a combinator along the lines of > (&&&) :: Lens' a b -> Lens' a b' -> Lens' a (b,b') > I can see how it could lead to lenses that don't follow the laws, but > for Lenses which are somehow independent (like _1 and _2), it works > perfectly well. Is there a way in lens to specify this "independence"?
If you don't mind violating the laws (ie. ensuring you access fields non-independently), then you could do this manually with a splitting/joining “isomorphism” at one end, and joining the other lenses using ‘alongside’. For example: iso (join (,)) (fst *** snd).alongside _1 _2 :: Lens (a,b) (a',b') (a,b) (a',b') Of course, this particular lens is utterly trivial (it's just id). And I'm not sure how much sense it makes to extend this pattern to more complicated cases. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe