为什么 FParsec 示例没有 运行?
Why doesn't the FParsec example run?
所以我运行从 FParsec 示例中提取了以下代码,但它似乎不想 运行。
namespace Test
open FParsec.CharParsers
module Stuff =
let main = run pfloat "1.25E3"
let str s = pstring s
let floatBetweenBrackets = str "[" >>. pfloat .>> str "]"
问题出在最后一行 - 我收到此错误:
Error 1 Expecting a type supporting the operator '>>.' but given a function type. You may be missing an argument to a function. C:\Users\...\Documents\Visual Studio 2013\Projects\Solution2\ConsoleApplication1\load.fs 6 42 Formatting
代码来自这里:
http://www.quanttec.com/fparsec/tutorial.html#parsing-a-float-between-brackets
如果重要的话,我 运行ning 的 F# 版本是:
Microsoft (R) F# Interactive version 12.0.30110.0
>>.
定义在FParsec.Primitives
中,所以你也需要打开它。或者,您可以只打开 FParsec
、since
Opening the FParsec namespace also automatically opens the Primitives, CharParsers and Error modules.
解释了您看到的错误的原因。
所以我运行从 FParsec 示例中提取了以下代码,但它似乎不想 运行。
namespace Test
open FParsec.CharParsers
module Stuff =
let main = run pfloat "1.25E3"
let str s = pstring s
let floatBetweenBrackets = str "[" >>. pfloat .>> str "]"
问题出在最后一行 - 我收到此错误:
Error 1 Expecting a type supporting the operator '>>.' but given a function type. You may be missing an argument to a function. C:\Users\...\Documents\Visual Studio 2013\Projects\Solution2\ConsoleApplication1\load.fs 6 42 Formatting
代码来自这里:
http://www.quanttec.com/fparsec/tutorial.html#parsing-a-float-between-brackets
如果重要的话,我 运行ning 的 F# 版本是:
Microsoft (R) F# Interactive version 12.0.30110.0
>>.
定义在FParsec.Primitives
中,所以你也需要打开它。或者,您可以只打开 FParsec
、since
Opening the FParsec namespace also automatically opens the Primitives, CharParsers and Error modules.