Visual Studio - f# - 错误FS0588:阻止这个'让'尚未完成

时间:2014-11-09 17:56:48

标签: visual-studio-2012 f# let

我的代码如下:

type appointment=
 |Probationary of int
 |Fixed

type GradeLevel = 
    | Junior_Dev of appointment
    | Dev
    | Senior_Dev
    | PM
    | Architect of int

type person = {gradeLevel: GradeLevel ; title: string; salary: float; name: string}


let John_C = {gradeLevel=Dev; title="Hamster..."; salary= 3500000.0; name= "John Connor"}
let James_J = {gradeLevel=Junior_Dev (Probationary 3); title="Gofer"; salary= 3500000.0; name= "James Joyce"}


let splitter (EmpList: person list) = 
     let rec splitter remaining (j,d,s,p,a) = //HERE IS THE LINE OF THE ERROR
        match remaining with
        | [] -> (j,d,s,p,a)
        | x::xs ->
            match x.gradeLevel with
            | Junior_Dev w -> splitter xs (x::j, d, s, p, a)
            | Dev -> splitter xs (j, x::d, s, p, Arch)
            | Senior_Dev -> splitter xs (j, d, x::s, p, a)
            | PM -> splitter xs (j, d, s, x::p, a)
            | Architect w -> splitter xs (j, d, s, p, x::a)
     splitter EmpList ([],[],[],[],[])

我似乎无法在那条线上发现我的错误。 基本上是分配器:我想拿一个员工列表并返回一个带有Gradelevel列表的元组......所以我可以看到我所有的开发人员和PM分别使用这个功能。

你看错了什么?谢谢

1 个答案:

答案 0 :(得分:0)

此代码为我编译:

type appointment=
    | Probationary of int
    | Fixed

type GradeLevel = 
    | Junior_Dev of appointment
    | Dev
    | Senior_Dev
    | PM
    | Architect of int

type person = {gradeLevel: GradeLevel ; title: string; salary: float; name: string}


let John_C = {gradeLevel=Dev; title="Hamster..."; salary= 3500000.0; name= "John Connor"}
let James_J = {gradeLevel=Junior_Dev (Probationary 3); title="Gofer"; salary= 3500000.0; name= "James Joyce"}


let splitter (EmpList: person list) = 
     let rec splitter remaining (j,d,s,p,a) =
        match remaining with
        | [] -> (j,d,s,p,a)
        | x::xs ->
            match x.gradeLevel with
            | Junior_Dev w -> splitter xs (x::j, d, s, p, a)
            | Dev -> splitter xs (j, x::d, s, p, a)
            | Senior_Dev -> splitter xs (j, d, x::s, p, a)
            | PM -> splitter xs (j, d, s, x::p, a)
            | Architect w -> splitter xs (j, d, s, p, x::a)
     splitter EmpList ([],[],[],[],[])

我用Arch替换了原始代码中的a