Tuesday, November 26, 2013

F# This expression is a function value, i.e. is missing arguments. Its type is List -> 'a -> List.

A common problem, when I refactor bigger chunks of F# code. This warning basically means that the indentation is incorrect. In my experience usually some parameters are not indented correctly. As an example:
let checkUrls = 
    Seq.fold (fun (acc:List) (x:string) -> 
        if (AsyncHttp(x) = HttpStatusCode.OK) then 
            (x :: acc) 
        else
            acc)
    []
    urls

In example above [] and URLs should be indented further then the call to the function, so it should look like a code below:
let checkUrls = 
    Seq.fold (fun (acc:List) (x:string) -> 
        if (AsyncHttp(x) = HttpStatusCode.OK) then 
            (x :: acc) 
        else
            acc)
        []
        urls