As a programming exercise I'm trying to use the State monad to create a simple 
parser.  It's for a very simple assembly language for a simple virtual machine. 
 The state is a string of instructions.  I want to be able to call something 
like getNextInstruction to pull out the next instruction and then update the 
state (string).  I know I can do this non-monadically by just passing the 
string explicitly each time but I'd like to learn more about the State monad.  
I also know about Parsec and Happy and so forth but this is just an exercise so 
I want to do it this way.  Any ideas?  I can't seem to get anything to work.  
I've tried different things but I suspect I'm just missing something basic.  
Can someone post a simple prototype for this?  Just assume the instructions are 
integers.




       
____________________________________________________________________________________
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
http://new.toolbar.yahoo.com/toolbar/features/mail/index.php
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to