<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	>
<channel>
	<title>Comments on: A Monad Tutorial for Ocaml</title>
	<atom:link href="http://enfranchisedmind.com/blog/posts/a-monad-tutorial-for-ocaml/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/posts/a-monad-tutorial-for-ocaml/</link>
	<description>programming, politics, &#38; other religious issues</description>
	<lastBuildDate>Thu, 11 Mar 2010 20:50:13 +0000</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Elias</title>
		<link>http://enfranchisedmind.com/blog/posts/a-monad-tutorial-for-ocaml/#comment-37086</link>
		<dc:creator>Elias</dc:creator>
		<pubDate>Sun, 13 Dec 2009 08:02:52 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-37086</guid>
		<description>i liked it :) i&#039;m bookmarking, thank you.

i just missed an explanation on doing functional I/O with monads -- this is something that looks very arcane and i never got it very well..</description>
		<content:encoded><![CDATA[<p>i liked it :) i&#8217;m bookmarking, thank you.</p>
<p>i just missed an explanation on doing functional I/O with monads &#8212; this is something that looks very arcane and i never got it very well..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Louis</title>
		<link>http://enfranchisedmind.com/blog/posts/a-monad-tutorial-for-ocaml/#comment-36843</link>
		<dc:creator>Louis</dc:creator>
		<pubDate>Sat, 05 Sep 2009 15:30:48 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-36843</guid>
		<description>I have a question about the int_val example.  I&#039;d have expected that read_int_val should have been something like

  let read_int_val = SerialMonad.bind int_val (fun r -&gt; (fun () -&gt; !r))

just to make the types work out.  What&#039;s wrong with how I am thinking about it?

Also, do you have sample code for the thread example?</description>
		<content:encoded><![CDATA[<p>I have a question about the int_val example.  I&#8217;d have expected that read_int_val should have been something like</p>
<p>  let read_int_val = SerialMonad.bind int_val (fun r -&gt; (fun () -&gt; !r))</p>
<p>just to make the types work out.  What&#8217;s wrong with how I am thinking about it?</p>
<p>Also, do you have sample code for the thread example?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paulo Villela</title>
		<link>http://enfranchisedmind.com/blog/posts/a-monad-tutorial-for-ocaml/#comment-36035</link>
		<dc:creator>Paulo Villela</dc:creator>
		<pubDate>Tue, 09 Jun 2009 06:35:35 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-36035</guid>
		<description>Your great tutorial demystifies monads and makes them accessible to OCaml programmers.  Thanks!</description>
		<content:encoded><![CDATA[<p>Your great tutorial demystifies monads and makes them accessible to OCaml programmers.  Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin L. Russell&#8217;s Adventures in Programming Language Theory Wonderland</title>
		<link>http://enfranchisedmind.com/blog/posts/a-monad-tutorial-for-ocaml/#comment-34013</link>
		<dc:creator>Benjamin L. Russell&#8217;s Adventures in Programming Language Theory Wonderland</dc:creator>
		<pubDate>Wed, 07 Jan 2009 09:10:08 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-34013</guid>
		<description>[...] Scheme &#8212; Benjamin L. Russell @ 6:09 pm   Recently, there was an interesting reference to a monad tutorial for the O&#8217;Caml programming language that provided an alternative perspective in helping to [...]</description>
		<content:encoded><![CDATA[<p>[...] Scheme &#8212; Benjamin L. Russell @ 6:09 pm   Recently, there was an interesting reference to a monad tutorial for the O&#8217;Caml programming language that provided an alternative perspective in helping to [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nicolas Pouillard</title>
		<link>http://enfranchisedmind.com/blog/posts/a-monad-tutorial-for-ocaml/#comment-34001</link>
		<dc:creator>Nicolas Pouillard</dc:creator>
		<pubDate>Mon, 05 Jan 2009 20:38:05 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-34001</guid>
		<description>@Norry Ogata
Your last mapD definition is not syntactically correct (fun (h x) -&gt; ...), maybe you want to write (fun h x -&gt; ...)
let mapD (h:’a-&gt;’b) (m:’a-&gt;’a list) = fun h x -&gt; (List.flatten(List.map h (m x)));;

@Brian
Thanks for this post! That&#039;s always a pleasure to see this concept being more-and-more popularized to other functional languages.

I have a small remark about your monads, in particular the return function. One have to remember that OCaml has a call-by-value semantics such that :

  let return x = fun () -&gt; x
 OR
  let return x = lazy x

Don&#039;t defer any effects, they are just there to fulfill the type, then expanding the definitions will not lead to the same result, &quot;return (print_int 3)&quot; is different from
&quot;lazy (print_int 3)&quot;, however this is maybe not that problematic.

Moreover, there is a typo in your bind definition (ill-scoped/ill-typed):
  let bind m f = lazy (Lazy.force g (Lazy.force m));;
 =&gt;
  let bind m f = lazy (Lazy.force (f (Lazy.force m)));;</description>
		<content:encoded><![CDATA[<p>@Norry Ogata<br />
Your last mapD definition is not syntactically correct (fun (h x) -&gt; &#8230;), maybe you want to write (fun h x -&gt; &#8230;)<br />
let mapD (h:’a-&gt;’b) (m:’a-&gt;’a list) = fun h x -&gt; (List.flatten(List.map h (m x)));;</p>
<p>@Brian<br />
Thanks for this post! That&#8217;s always a pleasure to see this concept being more-and-more popularized to other functional languages.</p>
<p>I have a small remark about your monads, in particular the return function. One have to remember that OCaml has a call-by-value semantics such that :</p>
<p>  let return x = fun () -&gt; x<br />
 OR<br />
  let return x = lazy x</p>
<p>Don&#8217;t defer any effects, they are just there to fulfill the type, then expanding the definitions will not lead to the same result, &#8220;return (print_int 3)&#8221; is different from<br />
&#8220;lazy (print_int 3)&#8221;, however this is maybe not that problematic.</p>
<p>Moreover, there is a typo in your bind definition (ill-scoped/ill-typed):<br />
  let bind m f = lazy (Lazy.force g (Lazy.force m));;<br />
 =&gt;<br />
  let bind m f = lazy (Lazy.force (f (Lazy.force m)));;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
