因此,我正在运行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如果重要的话,我正在运行的F#版本是:
Microsoft (R) F# Interactive version 12.0.30110.0发布于 2016-11-15 18:04:21
>>.是在FParsec.Primitives中定义的,所以您也需要打开它。或者,您只需打开FParsec,因为
打开FParsec命名空间还会自动打开主模块、CharParsers模块和错误模块。
这个答案解释了你所看到的错误是什么。
https://stackoverflow.com/questions/40615596
复制相似问题