5
我想从Suave.io编译一个简单的F#项目这个例子: http://suave.io/样品Suave.IO并不在我的F#项目编译
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" ]
不幸的是我得到一个编译器错误在(查询R)部分:
error FS0001: Expecting a type supporting the operator '^^' but given a function type. You may be missing an argument to a function.
我试图编译器错误缩小到几个简单的线条,现在有这样的:
let greetings q =
defaultArg (q ^^ "name") "World" |> sprintf "Hello %s"
let q (rqst : string) = query rqst
let t = greetings q
现在在问候q行上得到相同的编译器错误。 上面我的例子中的类型有:
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>)
所以,我的类型不匹配,但我不太知道我怎么会得到这些投其所好。
这个例子刚过时吗? 任何想法,我可以如何得到这个例子编译和运行?
我在运行Visual Studio的RC版本2015年
感谢
谢谢。我现在有你的帮助,现在开始运行样品。 我还发现我错过了开放的: 打开Suave.Utils.Collections 这有^^运营商的定义 –
@AndyB我实际上也注意到,但它不应该需要 - 模块是定义为'AutoOpen'。 – Luaan