<div dir="ltr">"Co-lift" is not possible for functors generally. Comonads have a method extract :: Comonad w => w a -> a, which is somewhat related.<div><br></div><div>Distributing and gathering are both really distributing. The first example distributes [] over f while the second example distributes f over []. Neither are possible for functors generally, but Applicative and Data.Traversable are strong enough to provide sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a). The problem is that the Applicative and Traversable laws alone are not enough to guarantee that this is well behaved.</div><div><br></div><div>What you actually need is a stronger notion that f (g a) is an "f-structure" containing "g-structures" <i>all of the same shape</i>. If they aren't, the inner structures won't be distributed properly and some of the odd shaped bits might get cut off. For example, try to transpose a list of lists (iow, distribute [] over []) and you'll see that all of the inner lists must be the same length for your transposition to be well behaved. Conor McBride covers this in a very interesting way in this StackOverflow answer: <a href="http://stackoverflow.com/a/13100857/2225384">http://stackoverflow.com/a/13100857/2225384</a></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 2, 2016 at 2:50 PM Joel Neely <<a href="mailto:joel.neely@gmail.com">joel.neely@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">IIUC, one would describe fmap as "lifting" a function g into a functor f, in the sense of </div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Functor f => (g a b) -> g a -> g b</div></blockquote></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Is there an inverse concept (? co-lift ?) that describes</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Functor f => (g a -> g b) -> a -> b</div></blockquote></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Similarly is there standard terminology for "distributing" and "gathering" in the sense of</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default"><blockquote style="font-family:georgia,serif;font-size:small;margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_default" style="font-family:georgia,serif;font-size:small">Functor f => f [a] -> [f a]</div></blockquote><font face="georgia, serif"><br></font></div><div class="gmail_default"><font face="georgia, serif">and</font></div><div class="gmail_default"><font face="georgia, serif"><br></font></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div class="gmail_default"><font face="georgia, serif">Functor f => [f a] -> f [a]</font></div></blockquote><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">respectively?</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">References much appreciated!</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small">-jn-</div><div class="gmail_default" style="font-family:georgia,serif;font-size:small"><br></div>-- <br><div>Beauty of style and harmony and grace and good rhythm depend on simplicity. - Plato</div>
</div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>