concatMap: (comparable -> Set comparable2) -> Set comparable -> Set comparable2
Map a given function onto a set and union the resulting set.
neighbors :: (Int, Int) -> Set (Int, Int)
neighbors (x, y) =
Set.fromList
[ (x - 1, y - 1), (x, y - 1), (x + 1, y - 1)
, (x - 1, y), (x + 1, y)
, (x - 1, y + 1), (x, y + 1), (x + 1, y + 1)
]
Set.Extra.concatMap neighbors setOfPoints
Map a given function onto a set and union the resulting set. neighbors :: (Int, Int) -> Set (Int, Int) neighbors (x, y) = Set.fromList [ (x - 1, y - 1), (x, y - 1), (x + 1, y - 1) , (x - 1, y), (x + 1, y) , (x - 1, y + 1), (x, y + 1), (x + 1, y + 1) ] Set.Extra.concatMap neighbors setOfPoints