Maqruis1
Maqruis1

Reputation: 167

Haskell: error: parse error on input ‘else’

avoidHookRule :: Int -> [Cards] -> Int
avoidHookRule initialBid hand = if decrementBid /= 0
                                    then
                                      decrementBid
                                    else
                                      if incrementBid <= length hand
                                          incrementBid
                                      else -- <- error occurs on this line 
                                          incrementBid - 2
                                where incrementBid = initialBid + 1
                                      decrementBid = initialBid - 1

As the title says I get the error on my else statement. Why is this happening? How do I fix it? Thank you

Upvotes: 1

Views: 469

Answers (1)

Koterpillar
Koterpillar

Reputation: 8198

if incrementBid <= length hand
    incrementBid
else -- <- error occurs on this line 
    incrementBid - 2

then is not optional and it is missing in this block.

Upvotes: 6

Related Questions