{-# LANGUAGE OverloadedStrings #-}
module Foo where
import Conduit
import Data.CSV.Conduit
textToCSV :: Text -> Vector (MapRow Text)
textToCSV txt = replicateC 1 txt
.| intoCSV defCSVSettings
.| sinkVector & runConduitPure & runIdentity
* No instance for (CSV Text (Vector (MapRow Text)))
arising from a use of `intoCSV'
* In the first argument of `(.|)', namely `intoCSV defCSVSettings'
In the second argument of `(.|)', namely
`intoCSV defCSVSettings .| sinkVector'
In the first argument of `(&)', namely
`replicateC 1 txt .| intoCSV defCSVSettings .| sinkVector'
|
156 | .| intoCSV defCSVSettings
| ^^^^^^^^^^^^^^^^^^^^^^
* No instance for (Data.Vector.Generic.Base.Vector
Identity (Vector (MapRow Text)))
arising from a use of `sinkVector'
* In the second argument of `(.|)', namely `sinkVector'
In the second argument of `(.|)', namely
`intoCSV defCSVSettings .| sinkVector'
In the first argument of `(&)', namely
`replicateC 1 txt .| intoCSV defCSVSettings .| sinkVector'
|
157 | .| sinkVector & runConduitPure & runIdentity
| ^^^^^^^^^^
当然,我同意
CSV Text Text
不存在。但是与我现在所做的相比
sourceFile
似乎有一个
similar usage
. 关于向量的第二个错误我也很困惑。
:
textToCSV
函数及其它几个辅助函数在my的构造中的应用
processCSV
processCSV :: (MonadResource m, MonadThrow m, PrimMonad m) =>
ConduitT FilePath Void m (Vector (Vector (MapRow Text)))
processCSV = mapMC (readCSVFile defCSVSettings) .| sinkVector