<?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"
	>
<channel>
	<title>Comments on: A Monad Tutorial for Ocaml</title>
	<atom:link href="http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/feed/" rel="self" type="application/rss+xml" />
	<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/</link>
	<description>Robert Fischer and Brian Hurt on Punditry, Programming Languages, and Other Religious Issues</description>
	<pubDate>Sat, 05 Jul 2008 18:45:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: Norry Ogata</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-32514</link>
		<dc:creator>Norry Ogata</dc:creator>
		<pubDate>Thu, 31 Jan 2008 09:05:48 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-32514</guid>
		<description>I'm ashamed that I couldn't notice the fact that generally exponent functors cannot be defined unless the functor is defined over cartesian-closed categories. Of course, the  functor D:'a -&#62; 'a list what I want to define is an exponent functor. So the type variable 'a must be restricted. I could define the limited version of D, say D', in a Haskell program by restricting 'a to "bounded and enumerable type classes" in the sense of Haskell. But even now I want to define D' in Ocaml. I know the Extlib library of Ocaml. Can we define D' in Ocaml?</description>
		<content:encoded><![CDATA[<p>I&#8217;m ashamed that I couldn&#8217;t notice the fact that generally exponent functors cannot be defined unless the functor is defined over cartesian-closed categories. Of course, the  functor D:&#8217;a -&gt; &#8216;a list what I want to define is an exponent functor. So the type variable &#8216;a must be restricted. I could define the limited version of D, say D&#8217;, in a Haskell program by restricting &#8216;a to &#8220;bounded and enumerable type classes&#8221; in the sense of Haskell. But even now I want to define D&#8217; in Ocaml. I know the Extlib library of Ocaml. Can we define D&#8217; in Ocaml?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norry Ogata</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-32112</link>
		<dc:creator>Norry Ogata</dc:creator>
		<pubDate>Wed, 19 Dec 2007 18:09:09 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-32112</guid>
		<description>Hi again,
In my previous comment,
I showed:
mapD (h:’a-&#62;’b) (m:’a-&#62;’a list) = fun x -&#62; (List.flatten(List.map h (m ((inv h) x))));;

Instead if:
mapD (h:’a-&#62;’b) (m:’a-&#62;’a list) = fun (h x) -&#62; (List.flatten(List.map h (m x)));;
is possible, it's fine, but such a definition is not accepted.</description>
		<content:encoded><![CDATA[<p>Hi again,<br />
In my previous comment,<br />
I showed:<br />
mapD (h:’a-&gt;’b) (m:’a-&gt;’a list) = fun x -&gt; (List.flatten(List.map h (m ((inv h) x))));;</p>
<p>Instead if:<br />
mapD (h:’a-&gt;’b) (m:’a-&gt;’a list) = fun (h x) -&gt; (List.flatten(List.map h (m x)));;<br />
is possible, it&#8217;s fine, but such a definition is not accepted.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norry Ogata</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-32111</link>
		<dc:creator>Norry Ogata</dc:creator>
		<pubDate>Wed, 19 Dec 2007 17:43:06 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-32111</guid>
		<description>Sorrry, in my previous comment, "inv has not unique value" is wrong. Naturally, (inv f) ,where f is a bijection, it must have a unique value. Even so, I couldn't have defined it yet.</description>
		<content:encoded><![CDATA[<p>Sorrry, in my previous comment, &#8220;inv has not unique value&#8221; is wrong. Naturally, (inv f) ,where f is a bijection, it must have a unique value. Even so, I couldn&#8217;t have defined it yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Norry Ogata</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-32110</link>
		<dc:creator>Norry Ogata</dc:creator>
		<pubDate>Wed, 19 Dec 2007 17:32:36 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-32110</guid>
		<description>Thank you very much.
I could study monads in OCaml as a beginner.
By the way, now I'm trying to make a monad of type of 'a-&#62;'a list, say D.
When I define bind and map of D,  I cannot define them.
My incomplete definitions of them are as follows:

let mapD (h:'a-&#62;'b) (m:'a-&#62;'a list) = fun x -&#62; (List.flatten(List.map h (m ((inv h) x))));;

let bindD (m:'a-&#62;'a list) (p:'a-&#62;'b-&#62;'b liist) 
= fun y -&#62; fun x -&#62;(List.flatten(List.map (fun a-&#62;(p a x)) (m y))

But, I noticed that function "inv" which means the inverse of a function does not have not unique value and I coundn't have defined yet.
Similarly, bindD is of type  ('a -&#62; 'a list) -&#62; ('a -&#62; 'b -&#62; 'b list) -&#62; 'a -&#62; 'b -&#62; ' b list,
although I want the function of type of ('a -&#62; 'a list) -&#62; ('a -&#62; 'b -&#62; 'b list) -&#62; 'b -&#62; ' b list.

Do you have any idea?</description>
		<content:encoded><![CDATA[<p>Thank you very much.<br />
I could study monads in OCaml as a beginner.<br />
By the way, now I&#8217;m trying to make a monad of type of &#8216;a-&gt;&#8217;a list, say D.<br />
When I define bind and map of D,  I cannot define them.<br />
My incomplete definitions of them are as follows:</p>
<p>let mapD (h:&#8217;a-&gt;&#8217;b) (m:&#8217;a-&gt;&#8217;a list) = fun x -&gt; (List.flatten(List.map h (m ((inv h) x))));;</p>
<p>let bindD (m:&#8217;a-&gt;&#8217;a list) (p:&#8217;a-&gt;&#8217;b-&gt;&#8217;b liist)<br />
= fun y -&gt; fun x -&gt;(List.flatten(List.map (fun a-&gt;(p a x)) (m y))</p>
<p>But, I noticed that function &#8220;inv&#8221; which means the inverse of a function does not have not unique value and I coundn&#8217;t have defined yet.<br />
Similarly, bindD is of type  (&#8217;a -&gt; &#8216;a list) -&gt; (&#8217;a -&gt; &#8216;b -&gt; &#8216;b list) -&gt; &#8216;a -&gt; &#8216;b -&gt; &#8216; b list,<br />
although I want the function of type of (&#8217;a -&gt; &#8216;a list) -&gt; (&#8217;a -&gt; &#8216;b -&gt; &#8216;b list) -&gt; &#8216;b -&gt; &#8216; b list.</p>
<p>Do you have any idea?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raj B</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-32084</link>
		<dc:creator>Raj B</dc:creator>
		<pubDate>Tue, 18 Dec 2007 05:31:58 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-32084</guid>
		<description>Great tutorial! I like reading your tutorials in general, you have a knack for making difficult concepts accessible. Do you have or plan to write one on CPS style?

A request: is it possible to somehow increase the size of the font you use to write code? It's almost too small to be readable compared to the size of the normal text. I'm using firefox on a Mac, so it's a pretty standard setup.</description>
		<content:encoded><![CDATA[<p>Great tutorial! I like reading your tutorials in general, you have a knack for making difficult concepts accessible. Do you have or plan to write one on CPS style?</p>
<p>A request: is it possible to somehow increase the size of the font you use to write code? It&#8217;s almost too small to be readable compared to the size of the normal text. I&#8217;m using firefox on a Mac, so it&#8217;s a pretty standard setup.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fabrice Marchant</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-31742</link>
		<dc:creator>Fabrice Marchant</dc:creator>
		<pubDate>Thu, 04 Oct 2007 20:45:39 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-31742</guid>
		<description>Very interesting. I wish to grasp the meaning of this mysterious monad that sounds like a female first name.

  I read here :
http://groups.google.com/group/fa.haskell/browse_frm/thread/c86fadfc0486ddae/63d448d4eea4df31?lnk=gst&#38;q=joel+reymont&#38;rnum=8#63d448d4eea4df31
that Haskell was useful to suggest techniques that can be used with other languages.

  One day, Virgile Prevosto send this on Beginners-list to solve a circular list problem :
http://tech.groups.yahoo.com/group/ocaml_beginners/message/8180

However, he did it an Haskell way, using a monad and I didn't understood a lot...
Now I can try to use this tutorial and notice the monad "return".

 Please, could you dismantle, at the light of this tuto., how module "State_monad" works ?

  Thanks for advance.</description>
		<content:encoded><![CDATA[<p>Very interesting. I wish to grasp the meaning of this mysterious monad that sounds like a female first name.</p>
<p>  I read here :<br />
<a href="http://groups.google.com/group/fa.haskell/browse_frm/thread/c86fadfc0486ddae/63d448d4eea4df31?lnk=gst&amp;q=joel+reymont&amp;rnum=8#63d448d4eea4df31" rel="nofollow">http://groups.google.com/group/fa.haskell/browse_frm/thread/c86fadfc0486ddae/63d448d4eea4df31?lnk=gst&amp;q=joel+reymont&amp;rnum=8#63d448d4eea4df31</a><br />
that Haskell was useful to suggest techniques that can be used with other languages.</p>
<p>  One day, Virgile Prevosto send this on Beginners-list to solve a circular list problem :<br />
<a href="http://tech.groups.yahoo.com/group/ocaml_beginners/message/8180" rel="nofollow">http://tech.groups.yahoo.com/group/ocaml_beginners/message/8180</a></p>
<p>However, he did it an Haskell way, using a monad and I didn&#8217;t understood a lot&#8230;<br />
Now I can try to use this tutorial and notice the monad &#8220;return&#8221;.</p>
<p> Please, could you dismantle, at the light of this tuto., how module &#8220;State_monad&#8221; works ?</p>
<p>  Thanks for advance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon Harrop</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-31712</link>
		<dc:creator>Jon Harrop</dc:creator>
		<pubDate>Tue, 25 Sep 2007 05:23:33 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-31712</guid>
		<description>Awesome post!</description>
		<content:encoded><![CDATA[<p>Awesome post!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roland Kaufmann</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-31601</link>
		<dc:creator>Roland Kaufmann</dc:creator>
		<pubDate>Thu, 30 Aug 2007 19:25:27 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-31601</guid>
		<description>I think that your wish has been granted: Version 1.2.0 of pa_monad is out, and it supports OCaml 3.10.</description>
		<content:encoded><![CDATA[<p>I think that your wish has been granted: Version 1.2.0 of pa_monad is out, and it supports OCaml 3.10.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-31568</link>
		<dc:creator>Brian</dc:creator>
		<pubDate>Mon, 13 Aug 2007 23:47:07 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-31568</guid>
		<description>Antoine: Yeah, I have a bad habit of using "monad" to mean the generic concept, a specific type, and an object of the specific type.  Of course, programmers do this all the time- for example, using the name 'integer' to refer to the platonic ideal (number), the specific data type (31-bit ints) and specific objects (7).  

augustss: The type of join is &lt;CODE&gt;'a t t -&#62; 'a t&lt;/CODE&gt;.  Yeah, the whole "working with monads" section should be wrapped in a functor, like:

&lt;CODE&gt;&lt;PRE&gt;module MonadMake(Monad: MonadRequirements) = struct&lt;BR&gt;    open Monad;;&lt;BR&gt;    ... much code here ...&lt;BR&gt;end;;&lt;/PRE&gt;&lt;/CODE&gt;

I vascillated over wether to spell this out or not- wether to just toss a functor in there and expect people to know what it is (limiting the scope of my audience, as even most Ocaml programmers are not the most comfortable with functors), or adding in a quick introduction to functors (distracting from the main thread of the post, and confusing and scaring off a lot of people- I've found, as a general rule, it's best to only introduce one big, scary word at a time- and both 'functor' and 'monad' qualify as big, scary words).  In the end I decided to just tap dance around the issue, and when someone mentioned in the comments "hey, shouldn't you use a functor there?" to reply with "why yes, you should!  But that's a topic for another post..."</description>
		<content:encoded><![CDATA[<p>Antoine: Yeah, I have a bad habit of using &#8220;monad&#8221; to mean the generic concept, a specific type, and an object of the specific type.  Of course, programmers do this all the time- for example, using the name &#8216;integer&#8217; to refer to the platonic ideal (number), the specific data type (31-bit ints) and specific objects (7).  </p>
<p>augustss: The type of join is <code>&#8216;a t t -&gt; &#8216;a t</code>.  Yeah, the whole &#8220;working with monads&#8221; section should be wrapped in a functor, like:</p>
<p><code>
<pre>module MonadMake(Monad: MonadRequirements) = struct    open Monad;;    &#8230; much code here &#8230;end;;</pre>
<p></code></p>
<p>I vascillated over wether to spell this out or not- wether to just toss a functor in there and expect people to know what it is (limiting the scope of my audience, as even most Ocaml programmers are not the most comfortable with functors), or adding in a quick introduction to functors (distracting from the main thread of the post, and confusing and scaring off a lot of people- I&#8217;ve found, as a general rule, it&#8217;s best to only introduce one big, scary word at a time- and both &#8216;functor&#8217; and &#8216;monad&#8217; qualify as big, scary words).  In the end I decided to just tap dance around the issue, and when someone mentioned in the comments &#8220;hey, shouldn&#8217;t you use a functor there?&#8221; to reply with &#8220;why yes, you should!  But that&#8217;s a topic for another post&#8230;&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: augustss</title>
		<link>http://enfranchisedmind.com/blog/2007/08/06/a-monad-tutorial-for-ocaml/#comment-31566</link>
		<dc:creator>augustss</dc:creator>
		<pubDate>Mon, 13 Aug 2007 04:24:29 +0000</pubDate>
		<guid isPermaLink="false">http://enfranchisedmind.com/blog/archive/2007/08/06/307#comment-31566</guid>
		<description>You didn't use type signatures much.  What's the type of, e.g., join?
Don't you need to put that in a functor to make it work for any monad?  And even if you do, you'll need a functor application when you want, e.g., join.</description>
		<content:encoded><![CDATA[<p>You didn&#8217;t use type signatures much.  What&#8217;s the type of, e.g., join?<br />
Don&#8217;t you need to put that in a functor to make it work for any monad?  And even if you do, you&#8217;ll need a functor application when you want, e.g., join.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
