Haskell &引用;输入时分析错误->&引用;在哈斯克尔

Haskell &引用;输入时分析错误->&引用;在哈斯克尔,haskell,Haskell,我正在编写一个函数,它接受一个日期列表(当前的形式是(年、月、日),其中每个日期都是Int:(Int,Int,Int))和一个月(作为Int),并返回该月在日期列表中出现的次数 我收到一个错误:“输入时解析错误->”,关于我在函数签名中的第一个'->' numberInMonth [(Int, Int, Int)] -> Int -> Int numberInMonth ((y,m,d) : rst) month = if y == month then 1 +(number

我正在编写一个函数,它接受一个日期列表(当前的形式是(年、月、日),其中每个日期都是Int:(Int,Int,Int))和一个月(作为Int),并返回该月在日期列表中出现的次数

我收到一个错误:“输入时解析错误->”,关于我在函数签名中的第一个'->'

numberInMonth [(Int, Int, Int)] -> Int -> Int
numberInMonth ((y,m,d) : rst) month = 
   if y == month then 1 +(numberInMonth rst) 
   else numberInMonth rst

关于为什么不进行解析,您有什么想法吗?

您只是缺少了类型签名中的

--------------|
--            V
numberInMonth :: [(Int, Int, Int)] -> Int -> Int
numberInMonth ((y,m,d) : rst) month = 
   if y == month then 1 +(numberInMonth rst) 
   else numberInMonth rst

您只是缺少类型签名中的

--------------|
--            V
numberInMonth :: [(Int, Int, Int)] -> Int -> Int
numberInMonth ((y,m,d) : rst) month = 
   if y == month then 1 +(numberInMonth rst) 
   else numberInMonth rst

您需要在函数签名中的函数名后添加
::
。意识到我忘记了::在numberInMonthWillem之后,谢谢!您需要在函数签名中的函数名后添加
::
。意识到我忘记了::在numberInMonthWillem之后,谢谢!