<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-11295132.post115499678320066610..comments</id><updated>2012-02-11T06:39:26.397-08:00</updated><category term='category theory'/><category term='lawvere theories'/><category term='astronomy'/><category term='optimisation'/><category term='self-reference'/><category term='comonads'/><category term='haskell'/><category term='programming'/><category term='monad'/><category term='mathematics'/><category term='physics'/><category term='probability'/><category term='types'/><category term='quantum'/><title type='text'>Comments on A Neighborhood of Infinity: You Could Have Invented Monads! (And Maybe You Alr...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.sigfpe.com/feeds/115499678320066610/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default?start-index=26&amp;max-results=25'/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://homepage.mac.com/sigfpe/.Pictures/Photo%20Album%20Pictures/2002-12-07%2014.53.40%20-0800/ImageDSC01397_1.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>57</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-11295132.post-2800920898208115555</id><published>2012-02-11T05:59:02.631-08:00</published><updated>2012-02-11T05:59:02.631-08:00</updated><title type='text'>The best tutorial on Monads! - Thank you</title><content type='html'>The best tutorial on Monads! - Thank you</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/2800920898208115555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/2800920898208115555'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1328968742631#c2800920898208115555' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-371033290'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-6385093929075074819</id><published>2010-12-31T18:16:42.730-08:00</published><updated>2010-12-31T18:16:42.730-08:00</updated><title type='text'>For not being a Haskell programmer, I&amp;#39;ve read ...</title><content type='html'>For not being a Haskell programmer, I&amp;#39;ve read a fair number of explanations of monads over the past year (I blame Reddit). So far, I&amp;#39;ve hit two that have helped; an eight-word definition (&amp;quot;Monads provide a generalized interface to sequential computation.&amp;quot;), and your exposition I just tripped across.&lt;br /&gt;&lt;br /&gt;You&amp;#39;ve managed to take something that is somewhat impenetrable when presented by others and make the concept not merely natural but truly inevitable once we reach a certain level of abstraction. I suspect this means you normally teach math.&lt;br /&gt;&lt;br /&gt;Anyway, thank you for this.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/6385093929075074819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/6385093929075074819'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1293848202730#c6385093929075074819' title=''/><author><name>Ray Lee</name><uri>http://www.blogger.com/profile/00675537654195582090</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-936085659'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-4805806486830725044</id><published>2010-12-13T02:57:27.296-08:00</published><updated>2010-12-13T02:57:27.296-08:00</updated><title type='text'>Thanks a lot for a great tutorial. 

I&amp;#39;ve been...</title><content type='html'>Thanks a lot for a great tutorial. &lt;br /&gt;&lt;br /&gt;I&amp;#39;ve been searching for a while and this is the best one I&amp;#39;ve found so far, both in books and on the net.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4805806486830725044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4805806486830725044'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1292237847296#c4805806486830725044' title=''/><author><name>Eternal</name><uri>http://www.blogger.com/profile/02512322446421154424</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1210147133'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-8408686222936201900</id><published>2010-11-17T15:40:04.427-08:00</published><updated>2010-11-17T15:40:04.427-08:00</updated><title type='text'>This tutorial is a great introduction to monads as...</title><content type='html'>This tutorial is a great introduction to monads as it starts with the problem and let the reader develop (or even invent) the solution. This helped me a lot, thanks!</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8408686222936201900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8408686222936201900'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1290037204427#c8408686222936201900' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-55832739'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-8908482156988681661</id><published>2010-08-19T07:24:19.904-07:00</published><updated>2010-08-19T07:24:19.904-07:00</updated><title type='text'>Anonymous,

The version I gave highlights a certai...</title><content type='html'>Anonymous,&lt;br /&gt;&lt;br /&gt;The version I gave highlights a certain symmetry in the signature. It&amp;#39;s of the form X -&amp;gt; F a -&amp;gt; F b. That&amp;#39;s slightly hidden in your version. Of course they are equivalent, but it&amp;#39;s this symmetry I want people to notice.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8908482156988681661'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8908482156988681661'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1282227859904#c8908482156988681661' title=''/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://homepage.mac.com/sigfpe/.Pictures/Photo%20Album%20Pictures/2002-12-07%2014.53.40%20-0800/ImageDSC01397_1.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-961546855'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-68484842084934044</id><published>2010-08-18T22:07:57.774-07:00</published><updated>2010-08-18T22:07:57.774-07:00</updated><title type='text'>Is it an academic convention to write your type si...</title><content type='html'>Is it an academic convention to write your type signatures like this?&lt;br /&gt;&lt;br /&gt;bind :: (a → StdGen → (b,StdGen)) → (StdGen → (a,StdGen)) → (StdGen → (b,StdGen))&lt;br /&gt;&lt;br /&gt;It would be much, much more clear if you wrote it like this:&lt;br /&gt;&lt;br /&gt;bind :: (a → StdGen → (b,StdGen)) → (StdGen → (a,StdGen)) → StdGen → (b,StdGen)&lt;br /&gt;&lt;br /&gt;Obviously the two are equivalent but it looks like you &lt;i&gt;intend&lt;/i&gt; for the first one to return a function rather than accept a third argument.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/68484842084934044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/68484842084934044'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1282194477774#c68484842084934044' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-30144870'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-1207427531491362859</id><published>2010-07-02T05:47:46.971-07:00</published><updated>2010-07-02T05:47:46.971-07:00</updated><title type='text'>An excellent tutorial. It really helped me a lot i...</title><content type='html'>An excellent tutorial. It really helped me a lot in understanding monads. The key was the &amp;#39;bind&amp;#39; function with the more natural order of parameters compared to &amp;#39;&amp;gt;&amp;gt;=&amp;#39;. The &amp;#39;*&amp;#39; operator really made clear what is going on, and it was really simple to define it in terms of &amp;#39;bind&amp;#39;. I also liked that you created exercises to force me stop and think, thus helping in the understanding of the concept.&lt;br /&gt;&lt;br /&gt;On the downside: the wording before the bind function of the random number example needs a little bit of improvement, exercise 7 was the most difficult because of it.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/1207427531491362859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/1207427531491362859'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1278074866971#c1207427531491362859' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1079797362'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-6614341734107112973</id><published>2010-03-09T13:22:04.934-08:00</published><updated>2010-03-09T13:22:04.934-08:00</updated><title type='text'>Bravo - what a great tutorial ! I&amp;#39;ve read abou...</title><content type='html'>Bravo - what a great tutorial ! I&amp;#39;ve read about a dozen articles and not really understood Monads but this one really hits the nail. Thanks.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/6614341734107112973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/6614341734107112973'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1268169724934#c6614341734107112973' title=''/><author><name>Andrew Whaley</name><uri>http://www.blogger.com/profile/05346078852977103014</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1294271855'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-1677672107139749547</id><published>2010-03-04T04:34:11.699-08:00</published><updated>2010-03-04T04:34:11.699-08:00</updated><title type='text'>It would be better to change unit * f = f * unit =...</title><content type='html'>It would be better to change unit * f = f * unit = f in the paragraph above Exercise Two into unit * f&amp;#39; = f&amp;#39; * unit = f&amp;#39;. And a space is missing in f&amp;#39;*g&amp;#39; in the same paragraph.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/1677672107139749547'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/1677672107139749547'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1267706051699#c1677672107139749547' title=''/><author><name>DAY</name><uri>http://www.blogger.com/profile/14359320866411018319</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://bp1.blogger.com/_ZTMsLJXHQjY/R-SQHiwVvaI/AAAAAAAAAEo/xEoSFycwbsc/S220/wizard.png'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-11989784'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-5512151803608431142</id><published>2009-11-24T01:23:04.451-08:00</published><updated>2009-11-24T01:23:04.451-08:00</updated><title type='text'>About the do notation, you basically said:

do {le...</title><content type='html'>About the do notation, you basically said:&lt;br /&gt;&lt;br /&gt;do {let x = y; more code} ==&amp;gt;&amp;gt; (\x -&amp;gt; do more code) y&lt;br /&gt;&lt;br /&gt;I was confused at first, until I performed the obvious beta reduction:&lt;br /&gt;&lt;br /&gt;let x = y in do more code&lt;br /&gt;&lt;br /&gt;This is actually closer to the original do notation, closer to the other rules, and I think a bit clearer.&lt;br /&gt;&lt;br /&gt;Anyway, thank you. I now have a way to explain monads to my poor C++ colleagues.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/5512151803608431142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/5512151803608431142'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1259054584451#c5512151803608431142' title=''/><author><name>Loup Vaillant</name><uri>http://www.loup-vaillant.fr</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-90476176'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-4617566318070231911</id><published>2009-08-06T04:35:31.952-07:00</published><updated>2009-08-06T04:35:31.952-07:00</updated><title type='text'>Great post, really made monads easy to understand....</title><content type='html'>Great post, really made monads easy to understand. &lt;br /&gt;&lt;br /&gt;Any chance you could write the same sort of thing on call/cc ?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4617566318070231911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4617566318070231911'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1249558531952#c4617566318070231911' title=''/><author><name>James Brooks</name><uri>http://www.blogger.com/profile/16899320910026266930</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='20' src='http://4.bp.blogspot.com/_jG8xAMdZeks/SkiTv_VSRcI/AAAAAAAAAAw/HT8r59n40iU/S220/2009-06-25-170646.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1658614021'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-5393432005687965855</id><published>2009-02-12T07:06:00.000-08:00</published><updated>2009-02-12T07:06:00.000-08:00</updated><title type='text'>Nice tutorial, but I don&amp;#39;t like &amp;quot;your fav...</title><content type='html'>Nice tutorial, but I don&amp;#39;t like &amp;quot;your favorite number&amp;quot; ;&amp;gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/5393432005687965855'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/5393432005687965855'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1234451160000#c5393432005687965855' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1622559978'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-1976554595602595064</id><published>2008-07-14T02:37:00.000-07:00</published><updated>2008-07-14T02:37:00.000-07:00</updated><title type='text'>In the line "Where we previously used a pair like ...</title><content type='html'>In the line "Where we previously used a pair like (a,s) we now use Writer (a,s) of type Writer Char.", shouldn't it be type Writer [Char]?&lt;BR/&gt;&lt;BR/&gt;Thanks.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/1976554595602595064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/1976554595602595064'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1216028220000#c1976554595602595064' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-677332625'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-402764880291408411</id><published>2008-06-05T16:34:00.000-07:00</published><updated>2008-06-05T16:34:00.000-07:00</updated><title type='text'>About the randomized functions: All the confusion ...</title><content type='html'>About the randomized functions: All the confusion is due to Curry-Howard iso making it unclear what is an argument and what is the return value. Depending on your view you get two different monad types. When you say "The first element of the pair that f returns" it seems clear that you view f as a 2-argument function which returns a pair and thus that the monad type should be (a, StdGen), but your solution of bind is the one for monad type StdGen -&gt; (a, StdGen) which results from viewing f as a function of one argument which returns a function.&lt;BR/&gt;Your choice of names x and x' in your definition of bind is VERY confusing. Might I suggest instead: bind f r = \s -&gt; let (x, s') = r s in f x s'? Other suggested rewording:&lt;BR/&gt;"We now must work out how to compose two randomized functions, f and g. The pair that the function that is returned by g returns needs to be decomposed and passed in as input to f. So we can give this signature for bind:".&lt;BR/&gt;It would also be very good if you could explain what happens if you choose the monad type to be (a, StdGen) and why that is a bad idea (if it is).&lt;BR/&gt;Lastly, I do think you offer a very enlightening view of monads, so thank you.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/402764880291408411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/402764880291408411'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1212708840000#c402764880291408411' title=''/><author><name>Marijn Schouten</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1419532154'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-8439804052180752082</id><published>2008-02-01T17:44:00.000-08:00</published><updated>2008-02-01T17:44:00.000-08:00</updated><title type='text'>knut,&lt;br&gt;&lt;br&gt;The function you defined is called "c...</title><content type='html'>knut,&lt;BR/&gt;&lt;BR/&gt;The function you defined is called "composition of Kleisli arrows". I wrote a bit about it here: http://sigfpe.blogspot.com/2006/06/monads-kleisli-arrows-comonads-and.html</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8439804052180752082'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8439804052180752082'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1201916640000#c8439804052180752082' title=''/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://homepage.mac.com/sigfpe/.Pictures/Photo%20Album%20Pictures/2002-12-07%2014.53.40%20-0800/ImageDSC01397_1.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-961546855'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-2219733969755729935</id><published>2008-02-01T17:31:00.000-08:00</published><updated>2008-02-01T17:31:00.000-08:00</updated><title type='text'>Great tutorial! I especially liked the comparison ...</title><content type='html'>Great tutorial! I especially liked the comparison between binding and function composition. In fact, for your examples, I find the "f*g" notation more succinct than both using &gt;&gt;= directly and the do notation. So far I haven't found an equivalent operator in Haskell, so for now I'm using the following:&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;&lt;BR/&gt;module MonadUtils where&lt;BR/&gt;(°) :: Monad m =&gt; (b -&gt; m c) -&gt; (a -&gt; m b) -&gt; (a -&gt; m c)&lt;BR/&gt;f ° g = (&gt;&gt;= f) . g&lt;BR/&gt;&lt;/B&gt;&lt;BR/&gt;&lt;BR/&gt;While probably not suitable for IO, it's a pretty neat way of writing stuff like&lt;BR/&gt;&lt;BR/&gt;&lt;B&gt;&lt;BR/&gt;sixthrt' = sqrt' ° cbrt'&lt;BR/&gt;(x',w) = runWriter $ (f ° g ° h) x&lt;BR/&gt;&lt;/B&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/2219733969755729935'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/2219733969755729935'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1201915860000#c2219733969755729935' title=''/><author><name>knut</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-298239204'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-7243156404598259314</id><published>2008-01-08T08:49:00.000-08:00</published><updated>2008-01-08T08:49:00.000-08:00</updated><title type='text'>Andrew,&lt;br&gt;&lt;br&gt;Sorry that caused confusion. Just t...</title><content type='html'>Andrew,&lt;BR/&gt;&lt;BR/&gt;Sorry that caused confusion. Just treat the two symbols the same way. At that point I was still trying to figure out which symbol was better to use and hadn't settled for one or the other. If I get time I'll try to make it consistent.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/7243156404598259314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/7243156404598259314'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1199810940000#c7243156404598259314' title=''/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://homepage.mac.com/sigfpe/.Pictures/Photo%20Album%20Pictures/2002-12-07%2014.53.40%20-0800/ImageDSC01397_1.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-961546855'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-7880861078022688400</id><published>2008-01-08T07:40:00.000-08:00</published><updated>2008-01-08T07:40:00.000-08:00</updated><title type='text'>One thing that confused me horribly about this pap...</title><content type='html'>One thing that confused me horribly about this paper.&lt;BR/&gt;&lt;BR/&gt;Sometimes you use "-&gt;" and sometimes "→", as in&lt;BR/&gt;&lt;BR/&gt;(a → m b) -&gt; (m a → m b)&lt;BR/&gt;&lt;BR/&gt;I thought that there might be some difference.&lt;BR/&gt;&lt;BR/&gt;Would it be too much to change this?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/7880861078022688400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/7880861078022688400'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1199806800000#c7880861078022688400' title=''/><author><name>Andrew Haley</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-208072596'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-6864216325375281530</id><published>2007-11-14T13:22:00.000-08:00</published><updated>2007-11-14T13:22:00.000-08:00</updated><title type='text'>OK, I've typed&lt;br&gt;test x g = (bind addDigit) . (bi...</title><content type='html'>OK, I've typed&lt;BR/&gt;test x g = (bind addDigit) . (bind shift) . addDigit&lt;BR/&gt;instead of&lt;BR/&gt;test = (bind addDigit) . (bind shift) . addDigit&lt;BR/&gt;Sorry for the interruption</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/6864216325375281530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/6864216325375281530'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1195075320000#c6864216325375281530' title=''/><author><name>d</name><uri>http://www.blogger.com/profile/00869107965007965693</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1068538717'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-4974780584859502742</id><published>2007-11-14T13:12:00.000-08:00</published><updated>2007-11-14T13:12:00.000-08:00</updated><title type='text'>Hi, I think that I finally got this monad stuff. B...</title><content type='html'>Hi, I think that I finally got this monad stuff. But there's a problem when I try to run the example from the appendix. Here's the error message:&lt;BR/&gt;    Couldn't match expected type `(Integer, StdGen)'&lt;BR/&gt;           against inferred type `Integer -&gt; StdGen -&gt; (Integer, StdGen)'&lt;BR/&gt;    In the expression: (bind addDigit) . ((bind shift) . addDigit)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4974780584859502742'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4974780584859502742'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1195074720000#c4974780584859502742' title=''/><author><name>d</name><uri>http://www.blogger.com/profile/00869107965007965693</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1068538717'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-881198955218541650</id><published>2007-10-20T12:55:00.000-07:00</published><updated>2007-10-20T12:55:00.000-07:00</updated><title type='text'>Jonathan,&lt;br&gt;&lt;br&gt;Yes, that's fine. On each line yo...</title><content type='html'>Jonathan,&lt;BR/&gt;&lt;BR/&gt;Yes, that's fine. On each line you're introducing a new x.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/881198955218541650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/881198955218541650'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1192910100000#c881198955218541650' title=''/><author><name>sigfpe</name><uri>http://www.blogger.com/profile/08096190433222340957</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://homepage.mac.com/sigfpe/.Pictures/Photo%20Album%20Pictures/2002-12-07%2014.53.40%20-0800/ImageDSC01397_1.jpg'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-961546855'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-764465156142911000</id><published>2007-10-20T12:53:00.000-07:00</published><updated>2007-10-20T12:53:00.000-07:00</updated><title type='text'>As an alternative to&lt;br&gt;&lt;br&gt;&amp;gt; do&lt;br&gt;&amp;gt;     le...</title><content type='html'>As an alternative to&lt;BR/&gt;&lt;BR/&gt;&gt; do&lt;BR/&gt;&gt;     let x = 7&lt;BR/&gt;&gt;     y &lt;- Writer (x+1,"inc\n")&lt;BR/&gt;&gt;     z &lt;- Writer (2*y,"double\n")&lt;BR/&gt;&gt;     Writer (z-1,"dec\n")&lt;BR/&gt;&lt;BR/&gt;I believe you could also write&lt;BR/&gt;&lt;BR/&gt;&gt; do&lt;BR/&gt;&gt;     let x = 7&lt;BR/&gt;&gt;     x &lt;- Writer (x+1,"inc\n")&lt;BR/&gt;&gt;     x &lt;- Writer (2*x,"double\n")&lt;BR/&gt;&gt;     Writer (x-1,"dec\n")&lt;BR/&gt;&lt;BR/&gt;   Is that right?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/764465156142911000'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/764465156142911000'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1192909980000#c764465156142911000' title=''/><author><name>Jonathan</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1505668889'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-8471332210762074471</id><published>2007-10-05T10:50:00.000-07:00</published><updated>2007-10-05T10:50:00.000-07:00</updated><title type='text'>Now let's say how I want the modeled function beha...</title><content type='html'>Now let's say how I want the modeled function behave.&lt;BR/&gt;&lt;BR/&gt;I'll take the example of the list of associations of the form (x,x+1) which I'll name "inc".&lt;BR/&gt;&lt;BR/&gt;The associations that "inc" models are of type (int,int) but to make the problem solvable, it internally includes a supplementary leading element in the tuple, so it is in fact internally:&lt;BR/&gt;(id,[(int,int)])&lt;BR/&gt;with an additional type representing the "id"entity of a solution. If this identity is known and is a solution to the "inc" function, then the list which which it is associated contains a single pair of type (int,int) and its value (x,y) satisfies the condition y=x+1.&lt;BR/&gt;&lt;BR/&gt;When coding the function, I want to be able to store it as a list of binding conditions representing the associations as a binding condition defining the satisfied association precisely as:&lt;BR/&gt;&lt;BR/&gt;[(id,x,x+1)]&lt;BR/&gt;&lt;BR/&gt;(the effective value of the id does not matter, it should be hidden by some syntax sugar of the language)&lt;BR/&gt;&lt;BR/&gt;and the function will also encode several solutions to allow the problems to be solved according to the values of the variables :&lt;BR/&gt;[(id,x,x+1)]&lt;BR/&gt;[(id,y-1,y)]&lt;BR/&gt;&lt;BR/&gt;(here also the value of the id should not be needed for the problems we need to solve, as the compiled function will internally compute them.&lt;BR/&gt;&lt;BR/&gt;So instead of encoding in the syntax the places where the id is present, we will assume that the syntax provides such sugar to do that, so that the function is can be written by just specifying in its definition:&lt;BR/&gt;[(x, x+1)]&lt;BR/&gt;OR&lt;BR/&gt;[(y-1, y)]&lt;BR/&gt;&lt;BR/&gt;In other words "inc" is now defined precisely as a list of tuples that it considers equivalent:&lt;BR/&gt;[(x, x+1), (y-1, y)]&lt;BR/&gt;&lt;BR/&gt;When "running" the function, we'll give similar list of tuples in input, the function will try to bind each tuple of its input with each tuple present in the list of its own definition, and if a match is found, it will return this matching tuple with the variables bounds in the list of tuples that are part of the solution.&lt;BR/&gt;&lt;BR/&gt;For making matches, the internal binding made by the "running" function will look for free variables present in its internal list of solutions, so given the input [(z,4)] that contains a free variable z for our problem, it binds successively each tuple of the input, i.e. (z,4) with each tuple in the list of proposed solutions:&lt;BR/&gt;&lt;BR/&gt;* the first solution is the tuple (x,x+1), so binding it with the input tuple (z,4) would require binding x with z (this is possible) and x+1 with 4 (i.e. z+1 with 4, but this won't work because you can't bind an expression containing free variables from the input to a constant that has no free variable); this first solution is then eliminated from the output&lt;BR/&gt;&lt;BR/&gt;* the second solution proposed by "inc" is the tuple (y-1,y), and binding it with the input (z,4) is possible: y-1 is bound to z (possible because both expressions contain free variables, this is the same as an equation y-1=z) and the second element y of the solution is bound to 4, so now y=4, and the tuple (y-1=z,y=4) is part of the solution, this tuple can be reduced because now y is not free and can be eliminated: (4-1=z,4) so finally the solution is (3=z,4)&lt;BR/&gt;&lt;BR/&gt;Finally the function returns the list of tuples [(3=z,4)] for the input [(z,4)], and this is exactly what we wanted to solve.&lt;BR/&gt;&lt;BR/&gt;The language may need to eliminate parts that are equivalent between the input and output, to provide a more readable solution by just keeping "3=z", i.e. the solution to the problem where z was free is now binding z to a value according to the definition of the "inc" function to which it was given. So the final solution is [(3,4)]&lt;BR/&gt;&lt;BR/&gt;In other words: inc [(z,4)] returns a [(3,4)] each solution being annotated with bindings (which are implicit here because they are part of the input/output parameters to the function in the same order, so the bining z=3 is implicit from the problem it had to solve)&lt;BR/&gt;&lt;BR/&gt;The difference here is that we are not limited by the curryfication.&lt;BR/&gt;&lt;BR/&gt;Such model will easily represent as a "function" any database table.&lt;BR/&gt;&lt;BR/&gt;The function would be written effectively something like:&lt;BR/&gt;&lt;BR/&gt;"inc" :: [(int,int)] -&gt; [(int,int)]&lt;BR/&gt; return [(x,x+1)] union [(y-1,y)]&lt;BR/&gt;&lt;BR/&gt;There are a few other missing syntaxic sugar here to make it work (notably, I used the term "list" everywhere when in fact the list is not ordered but is actually a "set" with no duplicate elements). This requires some more work to perform set operations (as suggested above when I introduced the word "union").&lt;BR/&gt;&lt;BR/&gt;How can I represent this extended "function" in Haskel? Can a monad represent such thing?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8471332210762074471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/8471332210762074471'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1191606600000#c8471332210762074471' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-890269050'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-3409615072357364859</id><published>2007-10-05T09:44:00.000-07:00</published><updated>2007-10-05T09:44:00.000-07:00</updated><title type='text'>Can you propose asolution in Haskell for the more ...</title><content type='html'>Can you propose asolution in Haskell for the more general problem of computing the input of a function from its result?&lt;BR/&gt;This is the general problem of solving equations, and we know that there may be several solutions to the problem, that the simple concept of currying will not solve always, or that will solve returning multiple solutions.&lt;BR/&gt;The concept could however be modeled by stating that the function input can be solved as a list that may be empty.&lt;BR/&gt;Is there a way to extend the concept of currrying a function one step further so that functions are now treated only as a pair consisting of its input and its output, so that we can pass it either the input or the output and compute the missing element of the pair according to the function definition?&lt;BR/&gt;Under this interpretation, we would not make any semantic difference between the function inputs (whatever their number) and the function outputs (also whatever their numbers): they are just indexed elements of a tuple, and currying is just one way to model the association (although currying just favors only one direction of solving problem, from the first member of the tuple to the last member).&lt;BR/&gt;&lt;BR/&gt;My idea is to be able to represent also, for example a database table (with unique rows) as a function, and each row in the table is a tuple of elements that can be either interpreted as inputs or outputs of a function, so that we can solve the problem of finding the value of a missing column by specifying the value of the other columns.&lt;BR/&gt;&lt;BR/&gt;To model a database table with non unique rows, we could reuse the same, because every row in a database table also has an implicit supplementary column that makes the row unique: the row number. under this representation, the database table canbe viewed as a curried function that takes a row number and returns the matching row as a tuple. But it could also take the tuple as input and return a list of matching row numbers. This is what I meanin a generalized currying concept: not favoring any direction of resolution. And here the concept of Monads could help by allowing to get in the return of a problem the list of values we are looking for in its return, "monadized" with the rest of the other column values given to the problem, the monad itself representing the association.&lt;BR/&gt;&lt;BR/&gt;Let's think about the type of such function:&lt;BR/&gt;* a table is now in fact an association whose type is a list of tuples of several types, one type for each column.&lt;BR/&gt;* to solve a problem with this table, we specify it also with a tuple (or list of tuples) filled with the values of the column we know, and the function matches it by binding the columns in the input list of tuples with its own internal list of tuples modeling each row in the table. When a match is found, the function returns this row in the list of inputs.&lt;BR/&gt;* now let's look at the function that takes a numeric input and return the input plus 1: its is similar as it can be viewed as anassociation of tuples of the form (x, x+1) so the function or table is modeled as a list of pairs. The problem it can solve would not only be the forward problem of finding a matching association (x,x+1) when we know the value of the first column x as a list of matching values for x+1, but also finding solutions for the reverse problem.&lt;BR/&gt;For forward problems, I want to be able to give to the function that internally stores the association as list of pairs, i.e. [(int,int)], feed it with a tuple of lists of type ([int],unknown) which represent the values we know, the function will perform the internal resolution by binding this input with its internal list of tuples and will return a tuple of lists filled with the values of the "unknow" elements.&lt;BR/&gt;so conceptually, the function I need is now of "type":&lt;BR/&gt;([int],unkown)-&gt;(???,[int])&lt;BR/&gt;but could also return just the list of its rows that match the input:&lt;BR/&gt;([int],unkown)-&gt;[(???,int)]&lt;BR/&gt;As there's no direction favored, the generalization of the problem will required using the more general problem of representing the problems we can solve with this function as:&lt;BR/&gt;[(int|unknown,int|unknown)]-&gt;[(int|unknown,int|unknown)]&lt;BR/&gt;in other words, the type of a problem with its solution according to a function is a pair of types, whose signature are both equals the type signature of the function itself!&lt;BR/&gt;Regading the function "+1" above, it is just a particular solution to the geneal concept represented in [(x,x+1)] as if it was a database table containing all the associations (as as list of tuples) between is input and its output.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/3409615072357364859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/3409615072357364859'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1191602640000#c3409615072357364859' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-439515065'/></entry><entry><id>tag:blogger.com,1999:blog-11295132.post-4789167592243414059</id><published>2007-09-13T16:48:00.000-07:00</published><updated>2007-09-13T16:48:00.000-07:00</updated><title type='text'>Misleading wording in the paragraph already finger...</title><content type='html'>Misleading wording in the paragraph already fingered above aside, this text is awesome! Honest thanks, you totally demystified monads to another HS newbie. And that's coming from a social sci major :) .</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4789167592243414059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/11295132/115499678320066610/comments/default/4789167592243414059'/><link rel='alternate' type='text/html' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html?showComment=1189727280000#c4789167592243414059' title=''/><author><name>David</name><uri>http://www.blogger.com/profile/01826791569652979776</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://blog.sigfpe.com/2006/08/you-could-have-invented-monads-and.html' ref='tag:blogger.com,1999:blog-11295132.post-115499678320066610' source='http://www.blogger.com/feeds/11295132/posts/default/115499678320066610' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-889709943'/></entry></feed>
