captureTo :: Board -> Square -> [ Move ]
captureTo b t = do
  pt <- [ Pawn, Knight, Bishop, Rook, Queen, King ]
  let sqrs = if pt == Pawn
             then pawnAttackBB t (b^.B.opponent)
             else moveFun b pt t
      pcs = sqrs .&. piecesOf b (b^.next) pt
  f <- toList pcs
  return $ defaultMove f t pt (b^.next)


------------------------------------------------------------------------------
-- moving to the specified square (non capture) to block a check
captureTo :: Board -> Square -> [ Move ]
captureTo b t = do
  pt <- [ Pawn, Knight, Bishop, Rook, Queen, King ]
  let sqrs = if pt == Pawn
             then pawnAttackBB t (b^.B.opponent)
             else moveFun b pt t
      pcs = sqrs .&. piecesOf b (b^.next) pt
  f <- toList pcs
  return $ defaultMove f t pt (b^.next)


------------------------------------------------------------------------------
-- moving to the specified square (non capture) to block a check
captureTo b t = do
  pt <- [ Pawn, Knight, Bishop, Rook, Queen, King ]
  let sqrs = if pt == Pawn
             then pawnAttackBB t (b^.B.opponent)
             else moveFun b pt t
      pcs = sqrs .&. piecesOf b (b^.next) pt
  f <- toList pcs
  return $ defaultMove f t pt (b^.next)


------------------------------------------------------------------------------
-- moving to the specified square (non capture) to block a check