Hi folks, I'm reading about F# and trying to apply it to my daily job.
I was already been able to load a CSV file with the help of
FSharp.Data from NuGet, but I did it a imperative style, I think. Now I'm trying to apply functional constructs, tried the following:
open System open System.IO open FSharp.Data [<EntryPoint>] let main argv = let data = argv. |> Path.Combine Environment.CurrentDirectory |> CsvFile.Load printfn "%A" data.Headers 0
What I'm missing here?
In my head
argv. is passed to the result of
Path.Combine Environment.CurrentDirectory which curried already have the current dir as the first
path then the combined result is given to
Did I get
|> and curring wrong?
CsvFile.Loadis probably ok
dotnet test FSharpSuite.Tests.fsproj
A) I should make the tests pass by mimicking the current compiler output? Scenario in which we want to limit future regressions having current state as a base. But we lose the intended behavior of the compiler declared in the old tests.
B) I'm doing things wrong by concatenating the Expectations from old tests. In this case how should I do?
Also the fsi thing you mentioned, can you help me get started? There is a fsx script somewhere?
This is a workaround if you cannot debug / run from VS.
You can start new instance of F# interactive, copy-paste the code snipped from your test and it will point you 1st waring/error
(int, string) Mapyou'll get a compiler warning: "warning FS0062: This construct is for ML compatibility. The syntax '(typ,...,typ) ident' is not used in F# code. Consider using 'ident<typ,...,typ>' instead. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'." So while you can do it, you probably shouldn't since
(int, string) Mapdoesn't gain any particular readability benefits over
Map<int, string>IMHO. (Whereas
int listflows naturally like English, so it's more readable at a glance than