假设我有一个文档,其文本由 Jade 式括号分隔,例如{{foo}}
. 我编写了一个似乎可以foo
正确提取的 Attoparsec 解析器:
findFoos :: Parser [T.Text]
findFoos = many $ do
manyTill anyChar (string "{{")
manyTill letter (string "}}")
测试它表明它有效:
> parseOnly findFoos "{{foo}}"
Right ["foo"]
> parseOnly findFoos "{{foo}} "
Right ["foo"]
现在,使用 中的Data.Conduit.Attoparsec
模块conduit-extra
,我似乎遇到了奇怪的行为:
> yield "{{foo}}" $= (mapOutput snd $ CA.conduitParser findFoos) $$ CL.mapM_ print
["foo"]
> yield "{{foo}} " $= (mapOutput snd $ CA.conduitParser findFoos) $$ CL.mapM_ print
-- floods stdout with empty lists
这是期望的行为吗?我应该在这里使用导管实用程序吗?对此的任何帮助都将是巨大的!