-- | -- Module : AutoProof.Internal.Utils.SetUtils -- Copyright : (c) Artem Mavrin, 2021 -- License : BSD3 -- Maintainer : artemvmavrin@gmail.com -- Stability : experimental -- Portability : POSIX -- -- Miscellaneous set-related functions. module AutoProof.Internal.Utils.SetUtils (toSet) where import Data.Set (Set) import qualified Data.Set as Set -- | Convert a foldable collection into a set. toSet :: (Ord a, Foldable t) => t a -> Set a toSet :: t a -> Set a toSet = (a -> Set a -> Set a) -> Set a -> t a -> Set a forall (t :: * -> *) a b. Foldable t => (a -> b -> b) -> b -> t a -> b foldr a -> Set a -> Set a forall a. Ord a => a -> Set a -> Set a Set.insert Set a forall a. Set a Set.empty