2014-09-26 86 views
2

我收到以下错误:Haskell在输入'|'时解析错误

parse error on input '|'

我的代码:

makeMove :: Player -> Board -> Maybe Board 
makeMove p b | hasWinner b == Nothing = getMove p rb ri 
             where rb = gameTree p b 
               ri = minimax p rb 
               ros2int (i' :> ri') = i' 
               rb2b (b':rbs') = b 
               getMove p (r:rs) (i:is) = let bs = map rb2b rs 
                      is = map ros2int is 
                      idx = elemIndex (maximum' is) is 
                      res (Nothing) = Nothing 
                      res (Just x) = Just ((bs)!!x) 
                     in res idx 
       | otherwise = Nothing 

不过,我想这会通过标签的干扰通常可以引起的,但我检查,我只用了空间,使couldn不是问题。任何人都可以帮我解决这个问题吗?

在此先感谢!

此致敬礼, Skyfe。

回答

10

where条款应该是所有后卫后:

fun a b 
    | one = ... 
    | oterwise = ... 
    where .... 
+0

那做的工作!谢谢! – user2999349 2014-09-26 14:08:15