使い方がわかりませんsetPosition
(Parsecライブラリ)。これは、テキストの2行目の最初の3文字を読み取る非常に単純なコードです。
import Text.ParserCombinators.Parsec
content = ["This is the first line",
"and this is the second one",
"not to talk about the third one"]
txt = unlines content
main = parseTest myPar txt
myPar = getPosition >>= \oldPos ->
let newPos = setSourceLine oldPos 2 in
setPosition newPos >>
count 3 anyChar
それでも、出力は「Thi」であり、「and」ではありません...非常に単純なものが欠けているように感じますが、残念ながら、何がわかりません。手伝って頂けますか?