Wadler&#39;s examples are way better than the ones in the documentation. But without his explanations of what he is doing, the examples alone are pretty worthless.<br><br>I agree that all_about_monads could be a better source for the documentation, at least for completeness. But even there I would consider choosing simpler examples, like Wadler&#39;s expression evaluator.<br>
<br><br><br><br><div class="gmail_quote">On Tue, Jan 13, 2009 at 21:07, Benedikt Huber <span dir="ltr">&lt;<a href="mailto:benjovi@gmx.net">benjovi@gmx.net</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Rafael Gustavo da Cunha Pereira Pinto schrieb:<div class="Ih2E3d"><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Yes, I&#39;ve read it twice, and it is a nice explanation that &quot;yes, the reader monad is an application and is a monad&quot;. How do I use it? Why not the function itself? How would the plumbing work in a real world example?<br>

</blockquote></div>
Hi Rafael,<br>
<br>
First of all, I agree that the documentation for mtl should be improved.<br>
Especially Control.Monad.RWS and Control.Monad.List really need some more information.<br>
<br>
The documentation for the Reader and Identity monad are quite detailled though. They seem to be &quot;inspired&quot; by <a href="http://www.haskell.org/all_about_monads/" target="_blank">http://www.haskell.org/all_about_monads/</a>, which also has documentation on Writer and Cont.<br>

<br>
Control.Monad.List is a good example for the lack of documentation:<br>
There is a single sentence at the beginning<br>
&gt; &quot;The List monad.&quot;<br>
and then one declaration<br>
&gt; newtype ListT m a = ListT { runListT :: m [a] }<br>
while the important information is hidden as one of many instance declarations:<br>
&gt; Monad m =&gt; Functor (ListT m)<br>
&gt; Monad m =&gt; MonadPlus (ListT m)<br>
<br>
Btw, the quality of the examples in Control.Monad.Reader is debutable. From Example 1:<br>
<br>
&gt; -- The Reader monad, which implements this complicated check.<br>
&gt; calc_isCountCorrect :: Reader Bindings Bool<br>
&gt; calc_isCountCorrect = do<br>
&gt; &nbsp; &nbsp;count &lt;- asks (lookupVar &quot;count&quot;)<br>
&gt; &nbsp; &nbsp;bindings &lt;- ask<br>
&gt; &nbsp; &nbsp;return (count == (Map.size bindings))<br>
<br>
I think it is wrong (or weird at least) to call the function a &#39;Reader monad&#39;; the name &#39;calc_isCountCorrect&#39; is horrible too (because of the calc_ prefix), &nbsp;Finally, implementing<br>
<br>
&gt; isCountCorrect :: Bindings -&gt; Bool<br>
&gt; isCountCorrect bs = (bs Map.! &quot;count&quot;) == Map.size bs<br>
<br>
using the Reader monad will convince everybody _not_ to use it.<br>
<br>
A suggestion: If license permits it, short versions of the articles on all_about_monads would make a great documentation for mtl (except for RWS and List, which are missing).<br>
<br>
benedikt<br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="Ih2E3d">
<br>
BTW, the article is really great as an brief introduction to monad transformers. For the whole concept of monads, my all time favorite is &quot;The Haskell Programmer&#39;s Guide to the IO Monad&quot; by Stefan Klinger.<br>

<br>
Chapters 14 to 19 of &quot;Real World Haskell&quot; also have a good introduction on the usage of the monads, but it lacks other monads, like the RWS or the Continuation...<br>
<br>
See, that is my point. The mathematical concept of monads is very palatable. The idea that monads are either patterns or structures to hide computations in sequence is also very easy to see. But how do we use them?<br>
Why should I use a Writer monad when I can use a (a,w) tuple?<br>
<br>
<br>
<br></div><div class="Ih2E3d">
On Tue, Jan 13, 2009 at 13:51, Jonathan Cast &lt;<a href="mailto:jonathanccast@fastmail.fm" target="_blank">jonathanccast@fastmail.fm</a> &lt;mailto:<a href="mailto:jonathanccast@fastmail.fm" target="_blank">jonathanccast@fastmail.fm</a>&gt;&gt; wrote:<br>

<br>
 &nbsp; &nbsp;On Tue, 2009-01-13 at 12:56 -0200, Rafael Gustavo da Cunha Pereira Pinto<br>
 &nbsp; &nbsp;wrote:<br>
 &nbsp; &nbsp; &gt;<br>
 &nbsp; &nbsp; &gt; Last night I was thinking on what makes monads so hard to take, and<br>
 &nbsp; &nbsp; &gt; came to a conclusion: the lack of a guided tour on the implemented<br>
 &nbsp; &nbsp; &gt; monads.<br>
<br>
 &nbsp; &nbsp;...<br>
<br>
 &nbsp; &nbsp; &gt; Inspired by the paper &quot;Functional Programming with Overloading and<br>
 &nbsp; &nbsp; &gt; Higher-Order Polymorphism&quot;,<br>
 &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; Mark P Jones<br>
 &nbsp; &nbsp; &gt; (<a href="http://web.cecs.pdx.edu/%7Empj/pubs/springschool.html" target="_blank">http://web.cecs.pdx.edu/~mpj/pubs/springschool.html</a><br></div>
 &nbsp; &nbsp;&lt;<a href="http://web.cecs.pdx.edu/%7Empj/pubs/springschool.html" target="_blank">http://web.cecs.pdx.edu/%7Empj/pubs/springschool.html</a>&gt;)<div class="Ih2E3d"><br>
 &nbsp; &nbsp; &gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Advanced School of Functional Programming, 1995.<br>
 &nbsp; &nbsp; &gt;<br>
 &nbsp; &nbsp; &gt; SO WHAT?<br>
<br>
 &nbsp; &nbsp;So have you read Jones&#39; paper? &nbsp;Or do you have a *concrete* explanation<br>
 &nbsp; &nbsp;of how it differs from your desired `guided tour&#39;?<br>
<br>
 &nbsp; &nbsp;jcc<br>
<br>
<br>
<br>
<br>
<br>
-- <br>
Rafael Gustavo da Cunha Pereira Pinto<br>
Electronic Engineer, MSc.<br>
<br>
<br></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote>
<br>
</blockquote></div><br><br clear="all"><br>-- <br>Rafael Gustavo da Cunha Pereira Pinto<br>Electronic Engineer, MSc.<br>