我正在通过以下方式打开一些 .txt 文件:
main :: IO ()
main = do
xxs <- TIO.readFile pathToFile
return ()
.txt 文件的格式为
str_1 \n str_2 \n ... str_m
我想将 xxs 制作为源代码,以便它看起来像:
sourceList [str_1, str_2, ..., str_m]
管道 API 是否提供了一种无需首先对 xxs 进行字符串操作的方法,从而将其转换为 [str_1, str_2, ..., str_m]< 的形式
?
最佳答案
How do you make the output of a
readfile
function into source for conduit?
包中已存在读取文件的源函数conduit-extra形式为sourceFile 。您还可以在该模块中看到各种其他组合器,例如 conduitFile
等。
关于haskell - 如何将 `readfile` 函数的输出变成管道的源?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38863636/