onTheTable' :: Int -> Table -> Bool
onTheTable' x (Table size) = 0 <= x && x < size

onTheTable :: (Int, Int) -> Table -> Bool
onTheTable (x, y) t = all (`onTheTable'` t) [x, y]

data Robot = Robot {
    x :: Int,
    y :: Int,
    direction :: Direction
  }
  deriving Eq

instance Show Robot where