如何将 `readfile` 函数的输出变成管道的源代码?

How do you make the output of a `readfile` function into source for conduit?

我正在通过以下方式打开一些 .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 in the form of sourceFile中已经存在读取文件的源函数。您还可以在该模块中看到各种其他组合器,例如 conduitFile