<div class="gmail_quote">On Dec 10, 2007 1:44 PM, Dan Piponi &lt;<a href="mailto:dpiponi@gmail.com">dpiponi@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">When someone comes to me and says &quot;I have this Python script that<br></div>scans through these directories and finds the files that meet these<br>criteria and generates a report based on this template, could I do it
<br>better in Haskell?&quot; it&#39;d be good to have a better answer than &quot;to do<br>this you could use the IO monad, but to do things properly you need to<br>understand monads so here, learn about the List monad and the Maybe
<br>monad first, understand how this interface abstracts from both, come<br>back when you&#39;ve finished that, and then I&#39;ll tell you how to read and<br>write files&quot;. </blockquote><div><br class="webkit-block-placeholder">
</div><div>I thought your blog post about the IO monad for people who don&#39;t care about monads (yet) was a pretty good start.</div><div><br class="webkit-block-placeholder"></div><div>As it happens, the IO monad was one of the things that attracted me to Haskell. When I was learning SML in college, I wondered how one could do I/O in a functional style. SML provides I/O via functions with side-effects, which struck me as crude and contrary to the functional style.
</div><div><br class="webkit-block-placeholder"></div><div>Years later, I encountered Haskell and learned that it handled I/O tasks using something called the &quot;IO monad&quot;. I had no idea what a monad was, but I understood the implications: Haskell could be referentially transparent *and* do I/O. This was what inspired me to learn the language.
</div><div><br class="webkit-block-placeholder"></div><div>As I learned more Haskell, I discovered the other monads and the Monad class and the full generality of the &quot;do&quot; notation. Eventually, a light came on and monads suddenly made sense.
</div><div><br></div><div>I don&#39;t know if it&#39;s best to learn the IO monad before or after other monads. I suspect no choice is right for everyone. An experienced programmer who is new to Haskell is going to have different questions than a beginning programmer with no preconceived notions.
</div><div><br class="webkit-block-placeholder"></div></div>-- <br>Dave Menendez &lt;<a href="mailto:dave@zednenem.com">dave@zednenem.com</a>&gt;<br>&lt;<a href="http://www.eyrie.org/~zednenem/">http://www.eyrie.org/~zednenem/
</a>&gt;