
2 May
2018
2 May
'18
12:10 p.m.
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?