Haskell缩进错误不会消失

时间:2014-12-18 01:33:36

标签: haskell

错误在scoreH h b n行:

parse error (possibly incorrect indentation or mismatched brackets)

当我将它缩进一个空格(不符合函数定义)时,我得到了

parse error on input =.

 scoreH :: Hand->DomBoard->Int->(Bool,[(Dom,End)]

 scoreH h b n = 
   let
     lPlays = leftdrops h b
     rPlays = rightdrops h b
     lPoss = leftScoreH lPlays b n
     rPoss = rightScoreH rPlays b n
   in
     if (length(lPoss) /= 0 || length(rPoss) /= 0) then (True,(lPoss++rPoss)) else (False,[(_,_)])


 rightScoreH :: Hand->DomBoard->Int->[(Dom,End)]

 rightScoreH [] _ _ = []

 rightScoreH (h:t) b n
    |scoreDom h R b == n = (h,R):rightScoreH t b n
    |otherwise = rightScoreH t b n

 leftScoreH :: Hand->DomBoard->Int->[(Dom,End)]

 leftScoreH [] _ _ = []

 leftScoreH (h:t) b n
    |scoreDom h L b == n = (h,L):leftScoreH t b n
    |otherwise = leftScoreH t b n

1 个答案:

答案 0 :(得分:7)

实际上这个问题根本没有与缩进有关,它就在第一行:签名缺少结束语。

                      (Bool,[(Dom,End)]   )

如果你在那里留下更多的空间,那就更明显了,比如

scoreH :: Hand -> DomBoard -> Int -> (Bool, [(Dom, End)]
                                     ⚡                  ⚡ clearly not closing