discoveredChecks :: Board -> [ Move ]
discoveredChecks b = do
  pt <- [ Queen, Rook, Bishop, Knight, King ]
  let ps = piecesOf b (b^.next) pt .&. discoverer b
  -- ps should be mempty most of the time..
  f <- toList ps
  t <- toList $ moveFun b pt f .&. complement (myPieces b)
  -- make sure that the enemy king is in check..
  guard $ inRayCheck b (occupancy b `xor` fromSquare f `xor` fromSquare t)
  return
    $ (capturedPiece .~ pieceAt b t)
    $ defaultMove f t pt (b^.next)


------------------------------------------------------------------------------
discoveredChecks :: Board -> [ Move ]
discoveredChecks b = do
  pt <- [ Queen, Rook, Bishop, Knight, King ]
  let ps = piecesOf b (b^.next) pt .&. discoverer b
  -- ps should be mempty most of the time..
  f <- toList ps
  t <- toList $ moveFun b pt f .&. complement (myPieces b)
  -- make sure that the enemy king is in check..
  guard $ inRayCheck b (occupancy b `xor` fromSquare f `xor` fromSquare t)
  return
    $ (capturedPiece .~ pieceAt b t)
    $ defaultMove f t pt (b^.next)


------------------------------------------------------------------------------
discoveredChecks b = do
  pt <- [ Queen, Rook, Bishop, Knight, King ]
  let ps = piecesOf b (b^.next) pt .&. discoverer b
  -- ps should be mempty most of the time..
  f <- toList ps
  t <- toList $ moveFun b pt f .&. complement (myPieces b)
  -- make sure that the enemy king is in check..
  guard $ inRayCheck b (occupancy b `xor` fromSquare f `xor` fromSquare t)
  return
    $ (capturedPiece .~ pieceAt b t)
    $ defaultMove f t pt (b^.next)


------------------------------------------------------------------------------