为什么我的代码错误

时间:2014-12-29 11:11:36

标签: haskell

在此脚本中,

data Move = Rock | Paper | Scissor
            deriving (Show,Eq)
    lose Rock       = Scissor
lose Paper      = Rock
lose _          = Paper

data Result = Win | Draw | Lose
              deriving (Show,Eq)

outcome :: Move -> Move -> Result
outcome x y
  | con1      == Win
  where
  con1 = (y==(lose x))

我想知道为什么会有

  

parse error on input "where"

感谢您的进步!

1 个答案:

答案 0 :(得分:4)

当您使用where ==时,可能需要=