<div class="Ih2E3d">On Fri, May 23, 2008 at 2:20 PM, Thomas Hartman &lt;<a href="mailto:tphyahoo@gmail.com" target="_blank">tphyahoo@gmail.com</a>&gt; wrote:<br></div><div class="gmail_quote"><div class="Ih2E3d"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div>&gt; The big benefit I got from using the State Monad was that I
was able to reorder the functions &gt; by just copy/pasting the
function name from one place to another.<br>
<br>
</div>I don&#39;t understand... why do you need state to do this? Couldn&#39;t you<br>
have a function pipeline using dots for composition like<br>
<br>
 &nbsp;.... (<br>
 &nbsp; &nbsp;...<br>
 &nbsp; &nbsp;parseAttn .<br>
 &nbsp; &nbsp;parsePoBox .<br>
 &nbsp; &nbsp;...<br>
 &nbsp; &nbsp;) address ...<br>
<br>
and have the functions be equally switchable? (well, the first and<br>
last can&#39;t quite be copy pasted, but close enough.)<br>
<br>
Introducing state seems like a lot of trouble to me if the only one is<br>
easier reorderability of lines.<br>
</blockquote></div><div><br>Agreed, in fact I started with a function
pipeline and then switched to using the State Monad. As the program was
written months ago I don&#39;t remember exactly why. Maybe I don&#39;t like to
read backwards. ;-)<br>
</div></div><br>Funtions running in the state monad can call other
functions with the same `State s a` signature (and so on as deep as you
want). You never have to care about passing parameters and restarting a
new pipeline. But of course you can easily do without the State Monad.
I don&#39;t think the State Monad allows to do thing that you can&#39;t do with
basic Haskell. It just makes code more readable (in my opinion at
least).<br><br>Olivier.<br>