I am trying to get this example from compiling Suave.io for a simple F # project: http://suave.io/
open Suave.Http.Applicatives open Suave.Http.Successful open Suave.Web open Suave.Types open Suave.Model let greetings q = defaultArg (q ^^ "name") "World" |> sprintf "Hello %s" let sample : WebPart = path "/hello" >>= choose [ GET >>= request(fun r -> OK <| greetings (query r)) POST >>= request(fun r -> OK <| greetings (form r)) NOT_FOUND "Found no handlers" ]
Unfortunately, I get a compiler error in the (query r) part:
error FS0001: Expecting a type supporting the operator '^^' but given a function type. You may be missing an argument to a function.
I tried to narrow the compiler error to a few simple lines and now this:
let greetings q = defaultArg (q ^^ "name") "World" |> sprintf "Hello %s" let q (rqst : string) = query rqst let t = greetings q
And now get the same compiler error in q welcome string. The types in my example above are:
query: string -> (string -> Choice<'T,string>) -> HttpRequest -> Choice<'T,string> greetings: (string -> (string -> Choice<obj,string>) -> HttpRequest -> Choice<obj, string>) -> string q: string -> ((string -> Choice<'a, string>) -> HttpRequest -> Choice<'a, string>)
So my types don't match, but I'm not too sure how to get them to match.
Is the example simply outdated? Any ideas how I can get this example to compile and run?
I am launching a Visual Studio 2015 RC build
thanks
source share