-- | All (8 at most) closest neighbours of a point within an area.
vicinity :: X -> Y   -- ^ limit the search to this area
         -> Point    -- ^ position to find neighbours of
         -> [Point]
vicinity lxsize lysize p =
  if inside p (1, 1, lxsize - 2, lysize - 2)
  then vicinityUnsafe p
  else [ res | dxy <- moves
             , let res = shift p dxy
             , inside res (0, 0, lxsize - 1, lysize - 1) ]
vicinity :: X -> Y   -- ^ limit the search to this area
         -> Point    -- ^ position to find neighbours of
         -> [Point]
vicinity lxsize lysize p =
  if inside p (1, 1, lxsize - 2, lysize - 2)
  then vicinityUnsafe p
  else [ res | dxy <- moves
             , let res = shift p dxy
             , inside res (0, 0, lxsize - 1, lysize - 1) ]
vicinity lxsize lysize p =
  if inside p (1, 1, lxsize - 2, lysize - 2)
  then vicinityUnsafe p
  else [ res | dxy <- moves
             , let res = shift p dxy
             , inside res (0, 0, lxsize - 1, lysize - 1) ]