[Haskell-cafe] profunctorial vs vanlaarhoven lenses
Paolino
paolo.veronelli at gmail.com
Wed May 2 16:29:09 UTC 2018
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.
.p
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?
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20180502/5c05b6e4/attachment.html>
More information about the Haskell-Cafe
mailing list