Successive arguments should be separated by spaces or tupled, and arguments involving function or method applications should be parenthesized
If you're new to F# you may have seen this exception on your code and started adding parenthesis and commas all over the place to get it to go away. Or perhaps you simply had no idea why the compiler wasn't happy. In this short article I'll show some code that causes the compiler error and an easy way to resolve it.
let upcoming = getUpcoming DateTime.UtcNow.AddDays(90)
There are a couple ways to handle the situation.
Assigning the result to a temporary value
let maxDate = DateTime.UtcNow.AddDays(90) let upcoming = getUpcoming maxDate
Using the pipeline operator
let upcoming = DateTime.UtcNow.AddDays(90) |> getUpcoming
Using the backpipe operator
let upcoming = getUpcoming <| DateTime.UtcNow.AddDays(90)
let upcoming = getUpcoming (DateTime.UtcNow.AddDays(90))
And because the call to
AddDays is a single argument you can actually remove the inner parenthesis around the
let upcoming = getUpcoming (DateTime.UtcNow.AddDays 90)