Q:

Why do i get the error message for a bool in a if statement

I am trying to make an if statement, where it should see if the list is empty or not. Then it should return a bool of true or false. But i get the error message. How do i correct this.

Lint: if a then true else false might be able to be refactored into a.

  let isGameOver (p : player ) (b : board) : bool =
  let fstb = fst b
  let sndb = snd b
    if List.sum (fst b) = 0 || List.sum (snd b) = 0 then
      true
    else 
      false 

A:

Your if expression has the format if a then true else false so you can refactor it as suggested. You can also replace the use of fst and snd with pattern matching:
let isGameOver (p : player) (fstb, sndb) : bool =
  List.sum fstb = 0 || List.sum sndb = 0

