Skip to content

Instantly share code, notes, and snippets.

@deque-blog
Created September 9, 2017 17:01
Show Gist options
  • Save deque-blog/d66fb745ea29771cbcc898e3a156bbd8 to your computer and use it in GitHub Desktop.
Save deque-blog/d66fb745ea29771cbcc898e3a156bbd8 to your computer and use it in GitHub Desktop.
intersectAll :: Foldable f => f (Shape coord) -> Shape coord
intersectAll shapes = Shape $ \coord -> all (`isInShape` coord) shapes
intersect :: Shape coord -> Shape coord -> Shape coord
intersect s1 s2 = intersectAll [s1, s2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment