sets-0.0.5.2: Ducktyped set interface for Haskell containers.

Safe HaskellNone
LanguageHaskell2010

Data.Set.Ordered.Unique.With

Contents

Description

Orient the ordering of your set by a different index, by first supplying a function (a -> k) to weigh each element. This module simply leverages Data.Map, and does not use a novel data type.

Note: This data type can only have one element per distinguished weight. For oriented multisets, use Data.Set.Ordered.Many.With.SetsWith.

Synopsis

Documentation

newtype SetWith k a #

Constructors

SetWith 

Fields

Instances

Ord k => HasInsert a (SetWith k a) # 

Methods

insert :: a -> SetWith k a -> SetWith k a #

Ord k => HasDelete a (SetWith k a) # 

Methods

delete :: a -> SetWith k a -> SetWith k a #

Foldable (SetWith k) # 

Methods

fold :: Monoid m => SetWith k m -> m #

foldMap :: Monoid m => (a -> m) -> SetWith k a -> m #

foldr :: (a -> b -> b) -> b -> SetWith k a -> b #

foldr' :: (a -> b -> b) -> b -> SetWith k a -> b #

foldl :: (b -> a -> b) -> b -> SetWith k a -> b #

foldl' :: (b -> a -> b) -> b -> SetWith k a -> b #

foldr1 :: (a -> a -> a) -> SetWith k a -> a #

foldl1 :: (a -> a -> a) -> SetWith k a -> a #

toList :: SetWith k a -> [a] #

null :: SetWith k a -> Bool #

length :: SetWith k a -> Int #

elem :: Eq a => a -> SetWith k a -> Bool #

maximum :: Ord a => SetWith k a -> a #

minimum :: Ord a => SetWith k a -> a #

sum :: Num a => SetWith k a -> a #

product :: Num a => SetWith k a -> a #

(Ord k, Monoid k) => Monoid (SetWith k a) # 

Methods

mempty :: SetWith k a #

mappend :: SetWith k a -> SetWith k a -> SetWith k a #

mconcat :: [SetWith k a] -> SetWith k a #

(Ord k, Eq a) => CanBeProperSubset (SetWith k a) # 

Methods

isProperSubsetOf :: SetWith k a -> SetWith k a -> Bool #

(Ord k, Eq a) => CanBeSubset (SetWith k a) # 

Methods

isSubsetOf :: SetWith k a -> SetWith k a -> Bool #

HasSize (SetWith k a) # 

Methods

size :: SetWith k a -> Int #

Ord k => HasDifference (SetWith k a) # 

Methods

difference :: SetWith k a -> SetWith k a -> SetWith k a #

Ord k => HasIntersection (SetWith k a) # 

Methods

intersection :: SetWith k a -> SetWith k a -> SetWith k a #

Ord k => HasUnion (SetWith k a) # 

Methods

union :: SetWith k a -> SetWith k a -> SetWith k a #

Ord k => HasSingletonWith (a -> k) a (SetWith k a) # 

Methods

singletonWith :: (a -> k) -> a -> SetWith k a #

HasEmptyWith (a -> k) (SetWith k a) # 

Methods

emptyWith :: (a -> k) -> SetWith k a #

Operators

(\\) :: Ord k => SetWith k a -> SetWith k a -> SetWith k a #

Query

null :: SetWith k a -> Bool #

size :: SetWith k a -> Int #

member :: Ord k => a -> SetWith k a -> Bool #

notMember :: Ord k => a -> SetWith k a -> Bool #

lookupLT :: Ord k => a -> SetWith k a -> Maybe a #

lookupGT :: Ord k => a -> SetWith k a -> Maybe a #

lookupLE :: Ord k => a -> SetWith k a -> Maybe a #

lookupGE :: Ord k => a -> SetWith k a -> Maybe a #

isSubsetOf :: (Eq a, Ord k) => SetWith k a -> SetWith k a -> Bool #

isProperSubsetOf :: (Eq a, Ord k) => SetWith k a -> SetWith k a -> Bool #

Construction

empty :: (a -> k) -> SetWith k a #

singleton :: Ord k => (a -> k) -> a -> SetWith k a #

insert :: Ord k => a -> SetWith k a -> SetWith k a #

delete :: Ord k => a -> SetWith k a -> SetWith k a #

Combine

union :: Ord k => SetWith k a -> SetWith k a -> SetWith k a #

unions :: Ord k => (a -> k) -> [SetWith k a] -> SetWith k a #

difference :: Ord k => SetWith k a -> SetWith k a -> SetWith k a #

intersection :: Ord k => SetWith k a -> SetWith k a -> SetWith k a #

Filter

filter :: (a -> Bool) -> SetWith k a -> SetWith k a #

partition :: (a -> Bool) -> SetWith k a -> (SetWith k a, SetWith k a) #

split :: Ord k => a -> SetWith k a -> (SetWith k a, SetWith k a) #

splitMember :: Ord k => a -> SetWith k a -> (SetWith k a, Bool, SetWith k a) #

splitRoot :: SetWith k a -> [SetWith k a] #

Indexed

lookupIndex :: Ord k => a -> SetWith k a -> Maybe Int #

findIndex :: Ord k => a -> SetWith k a -> Int #

elemAt :: Int -> SetWith k a -> a #

deleteAt :: Int -> SetWith k a -> SetWith k a #

Map

map :: (a -> b) -> (b -> a) -> SetWith k a -> SetWith k b #

mapMaybe :: (a -> Maybe b) -> (b -> a) -> SetWith k a -> SetWith k b #

Folds

foldr :: (a -> b -> b) -> b -> SetWith k a -> b #

foldl :: (b -> a -> b) -> b -> SetWith k a -> b #

Strict Folds

foldr' :: (a -> b -> b) -> b -> SetWith k a -> b #

foldl' :: (b -> a -> b) -> b -> SetWith k a -> b #

Legacy Fold

fold :: (a -> b -> b) -> b -> SetWith k a -> b #

Min/Max

findMin :: SetWith k a -> a #

findMax :: SetWith k a -> a #

deleteMin :: SetWith k a -> SetWith k a #

deleteMax :: SetWith k a -> SetWith k a #

deleteFindMin :: SetWith k a -> (a, SetWith k a) #

deleteFindMax :: SetWith k a -> (a, SetWith k a) #

minView :: SetWith k a -> Maybe (a, SetWith k a) #

maxView :: SetWith k a -> Maybe (a, SetWith k a) #

Conversion

elems :: SetWith k a -> [a] #

toList :: SetWith k a -> (a -> k, [a]) #

fromList :: (Ord k, Foldable f) => (a -> k) -> f a -> SetWith k a #

Ordered List

toAscList :: SetWith k a -> [a] #

toDescList :: SetWith k a -> [a] #

fromAscList :: Eq k => (a -> k) -> [a] -> SetWith k a #

fromDistinctAscList :: (a -> k) -> [a] -> SetWith k a #

Debugging

showTree :: (Show k, Show a) => SetWith k a -> String #

showTreeWith :: (k -> a -> String) -> Bool -> Bool -> SetWith k a -> String #