0

In this script,

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))

I wonder why there is a

parse error on input "where"

Thanks for your advance!

3
  • The problem is probably that con1 is on the wrong indentation level for the where block. You need to ensure that the code you've pasted in looks like the code in your editor so we can see what's misaligned. Commented Dec 29, 2014 at 11:17
  • 1
    @MrBones indentation isn't the problem. I pasted the code exactly as-is, without an indentation error. it's related to the use of == instead of = in the line above. Commented Dec 29, 2014 at 11:23
  • Fixing the indentation won't do harm, though. Commented Dec 29, 2014 at 15:18

1 Answer 1

4

In the line before the where you are using == when you probably meant =.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.