私はHaskellを初めて使用するので、この状況について助けが必要です。私は次のリストを持っています
-- create a type for bank account
type AcNo = String
type Name = String
type City = String
type Amnt = Int
type AcInfo = [(AcNo, Name, City, Amnt)]
-- function to get the data of bank accounts to a list of tuples
bankAccounts :: AcInfo
bankAccounts = [("oo1", "Sahan", "Colomb", 100),("002", "John", "Jafna", 200)]
私の要件は、口座番号に対応する金額を取得することです。たとえば、001の場合は100になります。
私が書いた関数はこれでした
--Function to check the balance of a person
checkBalance :: bankAccounts -> AcNo -> Amnt
checkBalance dbase number = Amnt|(AcNo, Name, City, Amnt) <- dbase, AcNo==number}
2行目は、imがスタックしている場所で、エラーメッセージが表示されます。
入力の構文エラー(予期しない `|')
これについて助けが欲しいのですが。ありがとう。