use*_*349 2 error-handling conditional haskell
我收到以下错误:
输入'|'解析错误
用我的代码:
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
Run Code Online (Sandbox Code Playgroud)
但是我认为这通常是由标签干扰引起的,但是我检查过,我只使用了空格,所以这不是问题所在.任何人都可以帮我解决这个问题吗?
提前致谢!
最好的问候,Skyfe.
Tom*_*omo 10
该where条款应该是所有警卫:
fun a b
| one = ...
| oterwise = ...
where ....
Run Code Online (Sandbox Code Playgroud)