------------------------------------------------------------------------------
discovererOrPinned
  :: Board
  -> Colour -- ^ Colour of the King
  -> Colour -- ^ Colour of the Piece that is pinned or gives discovered check
  -> BitBoard
discovererOrPinned b c1 c2 = mconcat $ do
  pt <- [ Rook, Bishop ]
  let kingPos = kingByColour c1 b
      -- King casting rays ..
      kingRay = pseudoAttackBB pt kingPos -- magic pt kingPos (occupancy b)
      casters = kingRay .&.
                (piecesOf b (T.opponent c1) pt
                 <> piecesOf b (T.opponent c1) Queen)
  caster <- toList casters
  let inBetween = lineBB kingPos caster
                  `xor` fromSquare kingPos
                  `xor` fromSquare caster
  guard (popCount (inBetween .&. occupancy b) < 2)
  return $ inBetween .&. piecesByColour b c2


------------------------------------------------------------------------------
discovererOrPinned
  :: Board
  -> Colour -- ^ Colour of the King
  -> Colour -- ^ Colour of the Piece that is pinned or gives discovered check
  -> BitBoard
discovererOrPinned b c1 c2 = mconcat $ do
  pt <- [ Rook, Bishop ]
  let kingPos = kingByColour c1 b
      -- King casting rays ..
      kingRay = pseudoAttackBB pt kingPos -- magic pt kingPos (occupancy b)
      casters = kingRay .&.
                (piecesOf b (T.opponent c1) pt
                 <> piecesOf b (T.opponent c1) Queen)
  caster <- toList casters
  let inBetween = lineBB kingPos caster
                  `xor` fromSquare kingPos
                  `xor` fromSquare caster
  guard (popCount (inBetween .&. occupancy b) < 2)
  return $ inBetween .&. piecesByColour b c2


------------------------------------------------------------------------------
discovererOrPinned b c1 c2 = mconcat $ do
  pt <- [ Rook, Bishop ]
  let kingPos = kingByColour c1 b
      -- King casting rays ..
      kingRay = pseudoAttackBB pt kingPos -- magic pt kingPos (occupancy b)
      casters = kingRay .&.
                (piecesOf b (T.opponent c1) pt
                 <> piecesOf b (T.opponent c1) Queen)
  caster <- toList casters
  let inBetween = lineBB kingPos caster
                  `xor` fromSquare kingPos
                  `xor` fromSquare caster
  guard (popCount (inBetween .&. occupancy b) < 2)
  return $ inBetween .&. piecesByColour b c2


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