Created
February 11, 2016 04:51
-
-
Save AphonicChaos/6663f5a89af9de56c296 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
import Data.Set hiding (foldr) | |
fromFoldable :: (Foldable f, Ord a) => f a -> Set a | |
fromFoldable = foldr insert empty | |
someSet = fromList [1, 2, 2, 3] | |
main = do | |
-- the first fromList could have been fromFoldable, but I wanted to show compatibility with the builtin functions | |
print $ intersection someSet (fromFoldable [2, 3, 4]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment