[Haskell-cafe] profunctorial vs vanlaarhoven lenses
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Wed May 2 16:43:57 UTC 2018
I'm not sure what you mean. If you want to write a profunctor traversal
then `wander lq5Twan` seems fine. If you want to understand why it's hard
to directly write profunctor traversals then I'm afraid I'm as puzzled as
On Wed, May 02, 2018 at 06:29:09PM +0200, Paolino wrote:
> Well, I can accept it as an evidence of why not to use the profunctor
> encoding for multi target lens (if that's the name).
> But I guess we are already in philosophy (so I'm more puzzled than before)
> and I hope you can elaborate more.
> 2018-05-02 18:10 GMT+02:00 Tom Ellis <
> tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk>:
> > On Wed, May 02, 2018 at 03:07:05PM +0200, Paolino wrote:
> > > I'm trying to write a lens for a datatype which seems easy in the Twan
> > van
> > > Laarhoven encoding but I cannot find it as easy in the profunctorial one
> > >
> > > data Q5 a b = Q51 a (Identity b) | Q52 [b]
> > >
> > > lq5Twan :: Applicative f => (b -> f b') -> Q5 a b -> f (Q5 a b')
> > > lq5Twan f (Q51 a bs) = Q51 a <$> traverse f bs
> > > lq5Twan f (Q52 bs) = Q52 <$> traverse f bs
> > [...]
> > > lq5Profunctor :: forall p a b b' . Traversing p => p b b' -> p (Q5 a
> > > b) (Q5 a b')
> > [...]
> > > Which simpler ways to write the lq5Profunctor we have ?
> > Is `wander lq5Twan` good enough, or is your question more philosophical?
More information about the Haskell-Cafe