<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - C9 Lectures: Greg Meredith - Monadic Design Patterns for the Web 4 of 4</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n/RSS"></atom:link>
	<image>
		<url>http://ak.channel9.msdn.com/ch9/5dc8/306290c6-26e4-444b-b112-9f1a01515dc8/C9LecturesMonadicDPWp4_100_ch9.jpg</url>
		<title>Channel 9 - C9 Lectures: Greg Meredith - Monadic Design Patterns for the Web 4 of 4</title>
		<link></link>
	</image>
	<description>Greg Meredith, a mathematician and computer scientist, has graciously agreed to do a C9 lecture series covering monadic design principles applied to web development. You&#39;ve met Greg before in a Whiteboard jam session with Brian Beckman. The fundamental concept here is the monad, and Greg has a novel and conceptually simplified explanation of what a monad is and why it matters. This is a very important and required first step in the series since the whole of it is about the application of monadic composition to real world web development. In part 4, Greg&amp;nbsp;primarily focuses on the idea that a monad is really an API—a view into the organization of data and control structures, not those structures themselves. In OO terms, it&#39;s an interface. To make this point concrete, Greg explores one of the simplest possible data structures supporting at least two different, though consistent, interpretations of the same API. The structure used, Conway&#39;s partisan games, turns out to be tailor-made for this investigation. Not only does this data structure have the requisite container-like shape, it provides opportunities to see just what&#39;s necessary in a container to implement the monadic interface.&amp;nbsp; Running throughout the presentation is a more general comparison of reuse between&amp;nbsp;an OO approach and a more functional one. When the monadic API is &amp;quot;mixed into&amp;quot; the implementing structure, we get less reuse than when the implementing structure is passed as a type parameter. Finally, doing the work puts us in a unique position to see not just how to generalize Conway&#39;s construction&amp;nbsp;monadically, but also the underlying pattern that allows the generalization to suggest itself.Source code for the Conway gameSlides for this presenation See part 1 See part 2See part 3 </description>
	<link></link>
	<language>en</language>
	<pubDate>Mon, 20 May 2013 18:31:51 GMT</pubDate>
	<lastBuildDate>Mon, 20 May 2013 18:31:51 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: C9 Lectures: Greg Meredith - Monadic Design Patterns for the Web 4 of 4</title>
		<description>
			<![CDATA[ <div class="lf secttl"><span id="thread_subject_site">Some background information for one of the slides: <a href="http://groups.google.com/group/scala-user/browse_thread/thread/09a289404c749023/4ba9beaec056350b">Difference between List and Set variance?</a></span></div><div class="lf secttl"><span></span></div><p>posted by ShinNoNoir</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634475269060000000</link>
		<pubDate>Fri, 29 Jul 2011 09:01:46 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634475269060000000</guid>
		<dc:creator>ShinNoNoir</dc:creator>
	</item>
	<item>
		<title>Re: C9 Lectures: Greg Meredith - Monadic Design Patterns for the Web 4 of 4</title>
		<description>
			<![CDATA[Thanks Greg &amp; Charles. Very much enjoyed this latest instalment. Looking forward to the next one and/or the book!<p>posted by Simon_W</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634475699820000000</link>
		<pubDate>Fri, 29 Jul 2011 20:59:42 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634475699820000000</guid>
		<dc:creator>Simon_W</dc:creator>
	</item>
	<item>
		<title>Re: C9 Lectures: Greg Meredith - Monadic Design Patterns for the Web 4 of 4</title>
		<description>
			<![CDATA[ <p>Hey this was great.&nbsp; What would this look like in F#?&nbsp; Thanks.</p><p>posted by AceHack</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634477336970000000</link>
		<pubDate>Sun, 31 Jul 2011 18:28:17 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634477336970000000</guid>
		<dc:creator>AceHack</dc:creator>
	</item>
	<item>
		<title>Re: C9 Lectures: Greg Meredith - Monadic Design Patterns for the Web 4 of 4</title>
		<description>
			<![CDATA[ <p>@<a href="/Shows/Going&#43;Deep/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634477336970000000">AceHack</a>:</p><p>F# has a DSL for monads called Computation Expressions so monads 'look' different in F#. Also, I think that once you have a monad implementation, the DSL makes it easier to use the implementation in your code.</p><p>So F# provides some extra language support for monads.</p><p>However, unlike Scala, F# does not have higher-kinded types so you cannot compose two monad implementations together (as easily).</p><p>I struggled with monads at first but then I realized that monads are really about function composition. Here is blog post that emphasizes this aspect of monads that may help with the understanding:</p><p><a href="http://fwaris.wordpress.com/2011/07/30/understanding-monads/">http://fwaris.wordpress.com/2011/07/30/understanding-monads/</a></p><p>posted by fwaris</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634478964270000000</link>
		<pubDate>Tue, 02 Aug 2011 15:40:27 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634478964270000000</guid>
		<dc:creator>fwaris</dc:creator>
	</item>
	<item>
		<title>Re: C9 Lectures: Greg Meredith - Monadic Design Patterns for the Web 4 of 4</title>
		<description>
			<![CDATA[ <p>Thank you Greg! Thank you Charles!</p><p>This one was really giving me a blast (and still is). Today I got my copy of <a href="http://www.amazon.com/Surreal-Numbers-Donald-Knuth/dp/0201038129/ref=sr_1_1?ie=UTF8&amp;qid=1312317149&amp;sr=8-1">D.E.Knuth's &quot;Surreal Numbers&quot;</a>, which is an excellent little intro to Conway numbers back from 1974, and I would like to recommend it here. I devoured it in one go and will read it again as soon as possible, then equipped with pencil and paper. The other book, <a href="http://www.amazon.com/Numbers-Games-John-H-Conway/dp/1568811276/ref=sr_1_2?ie=UTF8&amp;qid=1312317149&amp;sr=8-2">Conway's &quot;On Numbers and Games&quot;</a>, appearing in the slides, I have ordered already... and Greg's book is on the list <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /></p><p>Now, having settled the praise, here's something that sparked off quite towards the end of this installment. It's about abstracting over the container representation for 'left' and 'right'. Hmm, possibly there's a good thing even in Scala's oddity of non-variant (immutable!) Sets (see ShiNoNoir's link above).</p><p>Ok, I got two things, the second about transfinite ordinals. I know, that sounds quite scary/impressive - but it ain't really so (much). I have put together a postscript below (admittedly long for a post, but still...) which I hope establishes the relevant point while presuming virtually nothing. Please also leave your comment on that particular attempt alone, if you have some.</p><ul><li>&nbsp;Isn't the &quot;second hole&quot;, i.e. the abstraction over the containers just <em>including</em>&nbsp;the &quot;first hole&quot; that you poked? That is to say: once we're free to provide any container representation we like, can't we get rid of the A type parameter in GenConWayGame[M[_],A] and the <em>Either</em>[A, ...] in left and right and just &quot;push&quot; that into the M[_]? </li><li>The M[_] that we pass in to GenConWayGame is free to choose any (internal) representation of collections it prefers, as long as it provides unit and bind (and adheres to some &quot;Set contract&quot;, e.g. order-insensitive, duplicate-free etc), right? Well, if so why not represent Sets as the &quot;recipe&quot; how to create them, i.e. as <em>code</em>. I mean code as data, i.e. we're not going to execute that code but rather want to manipulate it. So ω would just be some (finite!) representation of code that,&nbsp;<em>if</em> executed, <em>would</em>&nbsp;give the empty set for right and for left enumerate the naturals, ad infinitum. Adding 1 to that, for example, would give code that,&nbsp;<em>if</em>&nbsp;executed, <em>would</em> give the empty set for right and for left enumerate {ω,2,3,4,....}. And, even better, we could simply return the equivalent ({ω}, {}). Not so hard to imagine how to represent <em>that</em>, is it? You see, it's calculating (=reasoning about) it,&nbsp;<em>not</em>&nbsp;actually writing it out. We'd like to&nbsp;<em>defer</em>&nbsp;as long as we can - at best forever <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /> </li></ul><p>&nbsp;____&nbsp;</p><p>p.s., &quot;<strong>What's that Conway ω, by the way?</strong>&quot; (simplifying quite a bit - as Greg mentioned, &quot;there's a lot of devil (detail) in there&quot;):</p><ol><li>To start, let's define a binary relation to compare Conway games, &quot;LTE&quot; (&quot;Less-Than-or-Equal&quot;): x = (X_L, X_R) is LTE &nbsp;y = (Y_L, Y_R) :IFF every x_L in X_L is LTE y AND x is LTE every y_R in Y_R. Again, this appears crazily circular but look, since it's composed of universal statements (&quot;for every foo in bar: ...&quot;) and we're starting from empty sets, it's well-founded (note that &quot;for every foo in the empty set: ...&quot; is always true, regardless of what the &quot;...&quot; say). </li><li>Not every Conway game is also a Conway number, i.e. there exist games g and h such that &nbsp;neither g LTE h nor h LTE g is the case. Odd as this may seem, it rather shows that the data structure is even more powerful than to &quot;just represent numbers&quot;. Anyways, let's consider Conway numbers only; these are the games x = (X_L, X_R) where we have: every x_L in X_L is LTE than any (=&quot;every&quot;) x_R in X_R.&nbsp; Again, this looks crazily circular but... - we're getting used to it, aren't we? </li><li>1) and 2) (not obviously) imply that every &quot;intuitive&quot; number has a many structurally distinct Conway numbers (or better &quot;numerals&quot;) that represent it. However, all those representations of one &quot;intuitive&quot; number have the common property to &quot;behave&quot; identically w.r.t. comparison, addition etc., i.e. they are &quot;practically the same&quot;. Even better, from all the representations that are equivalent in the said sense we can easily choose (=construct) a single canonical one to stand for them all - and thus forget about the problem altogether. We'll simply use the canonical one to denote &quot;or any of its equivalents&quot;. Oh, and btw, the set of equivalents (the &quot;equivalence class&quot;) for any number is infinite... </li><li>Uhm... actually there's a catch in 3), in particular the &quot;we can easily choose (=construct)&quot;. In fact, that's not entirely true when it comes to the interesting bits. Now what are these? Well,&nbsp; let's start by sticking with 3) for awhile and have a look at the non-negative integers only. We have 0 = ({},{}), then 1 = ({0}, {}), then 2 = ({1}, {}), then 3 = ({2}, {})... you get it: left is the set containing just the (set containing the) predecessor and right is always empty. These were the canonical representations as proposed in 3), but e.g. the &quot;intuitive&quot; number 2 could also be represented by ({0,1}, {}), that means ({0,1}, {}) &quot;is practically the same as&quot; ({1}, {}). Likewise, the &quot;intuitive&quot; number 3 could be as well represented by ({0,1,2}, {}) or ({0,2}, {}) or ({1,2}, {}). The &quot;trick&quot;, of course, is that the &quot;behavior&quot; solely depends on the <strong>maximal</strong> element (check yourself using the definition of LTE). Hence the choice of the canonical representative is straight-forward: simply use the singleton set with exactly that maximal element for left and the empty set for right. This covers all of the non-negative integers nicely. Now for the fun part <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif?v=c9' alt='Smiley' /> </li><li>Who said the left and/or right collections of a Conway number (or game, for that matter) need to be <em>finite</em>? Well, nobody, of course. But that means there is this critter: ({0,1,2,3,4,...}, {}), i.e. empty right and in left <strong>all</strong> the non-negative integers from 4). This actually is a Conway number according to 2), yet any non-negative integer from 4) is LTE it. Check it yourself, you'll see it's trivial. This critter is commonly denoted by <strong>ω</strong> and it was created on the day after infinitely many days (when the integers [and some more, like the rationals] were created), aka day aleph (1). Anyhow, here come the interesting bits: how to actually represent <strong>ω</strong> in a program? Obviously we cannot replay the &quot;trick&quot; from 3), as there is no maximal element (although we could agree on a canonical representation that contains just the singleton sets from 4) - but that doesn't help, it's still infinite). However, it's not at all hard to envision <strong>ω</strong>&nbsp;- or is it?! C'mon, all we're talking about is the pair of a) all the non-negative integers and b) the empty set, that ain't really hard. But wait, what is just <em>that</em>? It's an English sentence, consisting of... uhm... a number of characters - but definitely finite! And it characterizes this infinite critter <strong>ω</strong> . So... </li></ol><p>posted by limes</p>]]>
		</description>
		<link>http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634479294490000000</link>
		<pubDate>Wed, 03 Aug 2011 00:50:49 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Series/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web/C9-Lectures-Greg-Meredith-Monadic-Design-Patterns-for-the-Web-4-of-n#c634479294490000000</guid>
		<dc:creator>limes</dc:creator>
	</item>
</channel>
</rss>