<div dir="ltr"><div>Hallo.</div><div><br></div><div>You can try reusing fmap.</div><div><br></div><div>>>></div><div><br></div><div><span style="font-size:12.8px">data FunPB a b = FunPB { runFunPB :: a -> (a,[b]) </span><br></div><div><span style="font-size:12.8px"><br></span></div><div>fmap f (FunPB g) = FunPB $ fmap (fmap (fmap f)) g</div><div><br></div><div>>>></div><div><br></div><div>This works because (a->), (a,), and [] are all functors.</div><div><br></div><div>Freundliche Grüße,</div><div>Daniel.</div><div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 6, 2017 at 9:04 PM, MarLinn <span dir="ltr"><<a href="mailto:monkleyon@gmail.com" target="_blank">monkleyon@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
On 2017-05-06 20:38, David Kraeutmann wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The only lawful instance I can think of is:<br>
instance Functor (FunPB a) where<br>
   fmap f (FunPB g) = FunPB $ \k -> let (a,b) = g k in (a, fmap f b)<br>
<br>
which is fairly straightforward IMO.<br>
</blockquote></span>
And because it's closer to the original style:<br>
<br>
        fmap f = FunPB .((.)((<$>).(<$>)$f)). runFunPB<br>
<br>
Now it's STARRING INTO YOU SOUL. And it's also so much easier to read.<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<wbr>_________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bi<wbr>n/mailman/listinfo/haskell-caf<wbr>e</a><br>
Only members subscribed via the mailman list are allowed to post.</div></div></blockquote></div><br></div>