Graham Hutton has some great tutorials on parsing. Check out the "Are parsers monodic?" thread (not exact name) for a good reference.<br><br>There'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 "Slides", click on "8 Functional parsers", but you may just want to start from 1. They're really quick and painless.<br><br>Graham Hutton's tutorials are about the only tutorials on monads that make sense to me. 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 <- gets head
<br> case value of<br> "blah" -> return blah<br> "foo" -> return foo<br><br>dotest = evalState( processor )["blah","foo"]
<br><br><br>Note that I'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. If someone knows a more elegant/spelling-safe way of doing this that'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> (showConstr $ toConstr $ blah) -> return blah<br> (showConstr $ toConstr $ foo) -> return foo