Graham Hutton has some great tutorials on parsing.&nbsp; Check out the &quot;Are parsers monodic?&quot; thread (not exact name) for a good reference.<br><br>There&#39;s also a good tutorial at <a href="http://www.cs.nott.ac.uk/~gmh/book.html">
http://www.cs.nott.ac.uk/~gmh/book.html</a> In Section &quot;Slides&quot;, click on &quot;8 Functional parsers&quot;, but you may just want to start from 1.&nbsp; They&#39;re really quick and painless.<br><br>Graham Hutton&#39;s tutorials are about the only tutorials on monads that make sense to me.&nbsp; YMMV of course.
<br><br><br>Other than that... a list is an instance of State, I think (?), so you can do something like (writing this in directly, without trying to compile):<br><br>processor :: State a<br>processor = do value &lt;- gets head
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; case value of<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;blah&quot; -&gt; return blah<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;foo&quot; -&gt; return foo<br><br>dotest = evalState( processor )[&quot;blah&quot;,&quot;foo&quot;]
<br><br><br>Note that I&#39;m a total newbie, and I didnt check this compiles (almost certainly doesnt) so take this with a wodge of salt<br><br><br>I cant say I really like the way I have a case that selects on strings to decide which function to call.&nbsp; If someone knows a more elegant/spelling-safe way of doing this that&#39;d be really useful generally.
<br><br>For example something like this could be more spelling safe (if it worked) (maybe it does???):<br><br>case value of<br>&nbsp;&nbsp; (showConstr $ toConstr $ blah) -&gt; return blah<br>&nbsp;&nbsp; (showConstr $ toConstr $ foo) -&gt; return foo
<br><br>