Parsec.Prim:setInput

module Main where

import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Token
import Text.ParserCombinators.Parsec.Language

lexer  :: TokenParser ()
lexer  =  makeTokenParser(javaStyle)

test   = do { setInput "foo"
            ; string "foo"
            }

で、

Prelude> :l 20090127_parsec00.hs
[1 of 1] Compiling Main             ( 20090127_parsec00.hs, interpreted )
Ok, modules loaded: Main.
*Main> parseTest test "foo"
Loading package parsec-2.0 ... linking ... done.
"foo"
*Main> parseTest test "bar"
"foo"