简体   繁体   English

F#CSV提供程序类型不匹配

[英]F# CSV Provider type mismatch

I'm having an issue with the F# CSV Type provider and getting a type mismatch. 我在F#CSV类型提供程序上遇到问题,并且类型不匹配。 I'm new to F#, so it very well could be a basic issue. 我是F#的新手,所以它很可能是一个基本问题。 I have put the file up on blob storage so you can replicate easier. 我已将文件放在blob存储中,以便您更轻松地复制。 https://analyzethis.blob.core.windows.net/voterinfo/WakeCountyVoterCSV note: you will need to change the providers file location to your download location to replicate exactly. https://analyzethis.blob.core.windows.net/voterinfo/WakeCountyVoterCSV注意:您需要将提供者文件位置更改为下载位置,以进行精确复制。 You may be able to load dynamically from blob as well. 您也许还可以从blob动态加载。

The error I get is: 我得到的错误是:

Type mismatch: Expecting a seq< CsvProvider<...>.Row> -> int 类型不匹配:期望seq <CsvProvider <...>。Row>-> int

but given a 但给了

seq< CsvProvider<...>.Row> -> unit seq <CsvProvider <...>。Row>->单位

Type int does not match unit 类型int与单位不匹配

code: 码:

open FSharp.Data
type voterType = CsvProvider<"C:\\Users\\dacrook\\Documents\\vrdb\\VoterCSVData2.csv", AssumeMissingValues=true, MissingValues="">

[<EntryPoint>]
let main argv = 
    let voterData = voterType.Parse("C:\\Users\\dacrook\\Documents\\vrdb\\VoterCSVData2.csv")
    voterData.Rows |> Seq.iter(fun r -> printfn "%A" r)

Any assistance is greatly appreciated! 非常感谢您的协助!

Thanks, 谢谢,

~David 大卫

main has an expected return type of int so your last line of code in the main function needs to be an int expression main具有预期的int返回类型,因此main函数中的最后一行代码必须是int表达式

open FSharp.Data
type voterType = CsvProvider<"C:\\Users\\dacrook\\Documents\\vrdb\\VoterCSVData2.csv",   AssumeMissingValues=true, MissingValues="">

[<EntryPoint>]
let main argv = 
    let voterData = voterType.Parse("C:\\Users\\dacrook\\Documents\\vrdb\\VoterCSVData2.csv")
    voterData.Rows |> Seq.iter(fun r -> printfn "%A" r)
    0  // <--- Add an int as the return value

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM