moveTo :: Board -> Square -> [ Move ]
moveTo b t = do
  pt <- [ Pawn, Knight, Bishop, Rook, Queen ]
  let pwn  = filter (\(_, t', _) -> t' == t) $ pawnAdvanceSquares b
      sqrs = if pt == Pawn
             then foldr ((<>) . fromSquare . (\(f, _, _) -> f)) mempty pwn
             else moveFun b pt t
      pcs  = sqrs .&. piecesOf b (b^.next) pt
  f <- toList pcs
  return $ defaultMove f t pt (b^.next)

               
------------------------------------------------------------------------------
-- | enemy king position
moveTo :: Board -> Square -> [ Move ]
moveTo b t = do
  pt <- [ Pawn, Knight, Bishop, Rook, Queen ]
  let pwn  = filter (\(_, t', _) -> t' == t) $ pawnAdvanceSquares b
      sqrs = if pt == Pawn
             then foldr ((<>) . fromSquare . (\(f, _, _) -> f)) mempty pwn
             else moveFun b pt t
      pcs  = sqrs .&. piecesOf b (b^.next) pt
  f <- toList pcs
  return $ defaultMove f t pt (b^.next)

               
------------------------------------------------------------------------------
-- | enemy king position
moveTo b t = do
  pt <- [ Pawn, Knight, Bishop, Rook, Queen ]
  let pwn  = filter (\(_, t', _) -> t' == t) $ pawnAdvanceSquares b
      sqrs = if pt == Pawn
             then foldr ((<>) . fromSquare . (\(f, _, _) -> f)) mempty pwn
             else moveFun b pt t
      pcs  = sqrs .&. piecesOf b (b^.next) pt
  f <- toList pcs
  return $ defaultMove f t pt (b^.next)

               
------------------------------------------------------------------------------
-- | enemy king position