
16 Oct
2009
16 Oct
'09
11:39 p.m.
On Fri, Oct 16, 2009 at 12:33 AM, Daneel Yaitskov
I want to write a interpreter which does actions (IO) inside the parse function. But I don't know how to do it. That code show that What I need. Does trick exist that the block function can contain an action (putStr)?
IO actions inside the parse function? I don't think you should want to do this, what may work better is to have a parse function which consumes part of the input, producing a value representing as much as you're willing to interpret, along with the rest of the input. You can use Parsec's getInput function for this. eg: get1 = do token <- instruction remaining <- getInput return (remaining,token) Jeff.