5
type NI = Int
type Age = Int
type Balance = Int
type Person = (NI, Age, Balance)
type Bank = [Person]
sumAllAccounts :: NI -> Bank -> Int
sumAllAccounts n l = filter niMatch l
where niMatch n (a,_,_)
| n == a = True
| otherwise = False
當我運行這個功能我得到一個類型錯誤哈斯克爾類錯誤與在
couldnt match type (Person, t0, t1) -> Bool with Bool
然而,當我做了哪裏自身功能它工作
personNIMatchs :: NI -> Person -> Bool
personNIMatchs n (a,_,_)
| n == a = True
| otherwise = False
請包括'Bank'的定義。 – luqui