<div class="Ih2E3d">On Fri, May 23, 2008 at 2:20 PM, Thomas Hartman <<a href="mailto:tphyahoo@gmail.com" target="_blank">tphyahoo@gmail.com</a>> 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>> The big benefit I got from using the State Monad was that I
was able to reorder the functions > by just copy/pasting the
function name from one place to another.<br>
<br>
</div>I don't understand... why do you need state to do this? Couldn't you<br>
have a function pipeline using dots for composition like<br>
<br>
.... (<br>
...<br>
parseAttn .<br>
parsePoBox .<br>
...<br>
) address ...<br>
<br>
and have the functions be equally switchable? (well, the first and<br>
last can'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't remember exactly why. Maybe I don'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't think the State Monad allows to do thing that you can't do with
basic Haskell. It just makes code more readable (in my opinion at
least).<br><br>Olivier.<br>