ฉันต้องการฟังก์ชั่นที่ทำงานเช่น:
some :: (Int, Maybe Int) -> Int
some a b
| b == Nothing = 0
| otherwise = a + b
กรณีการใช้งาน:
some (2,Just 1)
some (3,Nothing)
map some [(2, Just 1), (3,Nothing)]
แต่รหัสของฉันทำให้เกิดข้อผิดพลาด:
The equation(s) for `some' have two arguments,
but its type `(Int, Maybe Int) -> Int' has only one
ฉันไม่เข้าใจมัน
ขอบคุณล่วงหน้า.
Maybe a
ตอบแล้วที่นี่ - person Thomas M. DuBuisson   schedule 07.12.2010