有谁知道为什么这不能编译?
type MyInterface<'input, 'output> =
abstract member MyFun: 'input -> 'output
type MyClass() =
interface MyInterface<string, unit> with
member this.MyFun(input: string) = ()
//fails with error FS0017: The member 'MyFun : string -> unit' does not have the correct type to override the corresponding abstract method.
type MyUnit = MyUnit
type MyClass2() =
//success
interface MyInterface<string, MyUnit> with
member this.MyFun(input: string) = MyUnit
Run Code Online (Sandbox Code Playgroud)
(fileNameToCharStream "bigfile"
|>> fuse [length;
splitBy (fun x -> x = ' ' || x = '\n') removeEmpty |>> length;
splitBy (fun x -> x = '\n') keepEmpty |>> length;
])
(*fuse "fuses" the three functions to run concurrently*)
|> run 2 (*forces to run in parallel on two threads*)
|> (fun [num_chars; num_words; num_lines] ->
printfn "%d %d %d"
num_chars num_words, num_lines))
我想以下列方式使这段代码工作:将原始流分成两个正好在中间; 然后为每一半运行一个单独的计算,计算3件事:长度(即字符数),字数,行数.但是,如果我错误地将一个单词分开,我不想有问题.这必须得到照顾.该文件应该只读一次.
我应该如何编程指定的函数和运算符| >>?可能吗?
我最近有过使用jquery和extjs做同样事情(搜索组合框)的经验.我发现extjs有缺陷且过于复杂.相反,我发现jquery工作得非常好并且非常简单.我想知道其他人使用extjs的经历是什么.extjs的复杂性实际上会给你带来什么吗?