pawnAdvanceSquares :: Board -> [ (Square, Square, Maybe Square) ]
pawnAdvanceSquares b = do
  step <- [ 1, 2 ]
  let myPawns'  = myPiecesOf b Pawn
      myPawns   = if step == 1 then myPawns' else myPawns' .&. mySecond
      mySecond  = rankBB $ if b^.next == White
                           then secondRank
                           else seventhRank
      unblocked = complement $ foldl1 (<>)
                  [ occupancy b `shift` direction (b^.next) (-8 * j)
                  | j <- [ 1 .. step ]
                  ]
  pawn <- toList $ myPawns .&. unblocked
  return (pawn, offset pawn $ step * direction (b^.next) 8, Nothing)


------------------------------------------------------------------------------
pawnAdvanceSquares :: Board -> [ (Square, Square, Maybe Square) ]
pawnAdvanceSquares b = do
  step <- [ 1, 2 ]
  let myPawns'  = myPiecesOf b Pawn
      myPawns   = if step == 1 then myPawns' else myPawns' .&. mySecond
      mySecond  = rankBB $ if b^.next == White
                           then secondRank
                           else seventhRank
      unblocked = complement $ foldl1 (<>)
                  [ occupancy b `shift` direction (b^.next) (-8 * j)
                  | j <- [ 1 .. step ]
                  ]
  pawn <- toList $ myPawns .&. unblocked
  return (pawn, offset pawn $ step * direction (b^.next) 8, Nothing)


------------------------------------------------------------------------------
pawnAdvanceSquares b = do
  step <- [ 1, 2 ]
  let myPawns'  = myPiecesOf b Pawn
      myPawns   = if step == 1 then myPawns' else myPawns' .&. mySecond
      mySecond  = rankBB $ if b^.next == White
                           then secondRank
                           else seventhRank
      unblocked = complement $ foldl1 (<>)
                  [ occupancy b `shift` direction (b^.next) (-8 * j)
                  | j <- [ 1 .. step ]
                  ]
  pawn <- toList $ myPawns .&. unblocked
  return (pawn, offset pawn $ step * direction (b^.next) 8, Nothing)


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