<div dir="ltr"><div class="gmail_extra">On Tue, Dec 15, 2015 at 12:43 AM, Graham Gill <span dir="ltr"><<a href="mailto:math.simplex@gmail.com" target="_blank">math.simplex@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":202" class="a3s" style="overflow:hidden">I guessed that the correct Extend instance for List is needed for Comonad, but didn't have any intuition about it.<br></div></blockquote><div><br></div><div>List is not comonadic. In this case, the function copure must be of type [a] -> a, which must necessarily be partial.<br></div><div><br>(Non-empty lists, on the other hand, are comonadic.)<br></div><div><br></div><div>Graham's "Extend" -- I'll explain the scare quotes in a minute -- instance for List obeys the associative law. So it's a valid instance but a bit boring. The exercise asks for an interesting instance.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":202" class="a3s" style="overflow:hidden">
The way the NICTA course is structured, there's no mention of the dependence between "extend" and "copure" (equivalent to extract and duplicate I suppose) via the Comonad laws when considering Extend first by itself. </div></blockquote><div><br></div><div>It's a bit terse, but you can find "<span class="pl-k">class</span> <span class="pl-e">Extend</span> <span class="pl-smi">f</span> => <span class="pl-e">Comonad</span> <span class="pl-smi">f</span><span class="pl-k">" in Comonad.hs. After all, we're only looking at the exercises. The live lecture version probably does talk about the dependence.<br></span></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":202" class="a3s" style="overflow:hidden">I'm not knocking the NICTA course. I've found it useful. A quick paragraph or two as you've written, stuck into the source files as comments, would improve it.</div></blockquote></div><br></div><div class="gmail_extra">Most folks are neutral about the course. If parts of it work for you, great. If not, no worries. The whole comonadic business is a bit obscure and some of the strongest haskell programmers don't bat an eyelid over not knowing it.<br><br></div><div class="gmail_extra">p.s. "Extend" doesn't agree with the CT literature. See the paragraph that starts "The dual problem is the problem of lifting a morphism" here:<br><br><a href="http://ncatlab.org/nlab/show/extension">http://ncatlab.org/nlab/show/extension</a><br><br></div><div class="gmail_extra">But calling it a "lift" or "lifting" will only add to the confusion since monad transformers got first dibs on the terminology. Which is why you sometimes see "coextend" or (for the flipped version) "cobind".<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">-- Kim-Ee</div></div>
</div></div>