stoeffel/set-extra/1.0.1

NOTE: this package is not compatible with Elm 0.19.1

Set.Extra

Convenience functions for working with Set.

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
subset : Set comparable -> Set comparable -> Bool

Check if a Set is a subset of another Set.

Set.Extra.subset (Set.fromList [1,2,3]) (Set.fromList [1,2,3,4,5]) -- True