| Safe Haskell | None | 
|---|---|
| Language | Haskell98 | 
Data.Set.Ordered
Description
Synopsis
- data OSet a
- empty :: OSet a
- singleton :: a -> OSet a
- (<|) :: Ord a => a -> OSet a -> OSet a
- (|<) :: Ord a => a -> OSet a -> OSet a
- (>|) :: Ord a => OSet a -> a -> OSet a
- (|>) :: Ord a => OSet a -> a -> OSet a
- (<>|) :: Ord a => OSet a -> OSet a -> OSet a
- (|<>) :: Ord a => OSet a -> OSet a -> OSet a
- newtype Bias (dir :: IndexPreference) a = Bias {- unbiased :: a
 
- type L = 'L
- type R = 'R
- null :: OSet a -> Bool
- size :: OSet a -> Int
- member :: Ord a => a -> OSet a -> Bool
- notMember :: Ord a => a -> OSet a -> Bool
- delete :: Ord a => a -> OSet a -> OSet a
- filter :: Ord a => (a -> Bool) -> OSet a -> OSet a
- (\\) :: Ord a => OSet a -> OSet a -> OSet a
- (|/\) :: Ord a => OSet a -> OSet a -> OSet a
- (/\|) :: Ord a => OSet a -> OSet a -> OSet a
- type Index = Int
- findIndex :: Ord a => a -> OSet a -> Maybe Index
- elemAt :: OSet a -> Index -> Maybe a
- fromList :: Ord a => [a] -> OSet a
- toAscList :: OSet a -> [a]
- toSet :: OSet a -> Set a
Documentation
Instances
| Foldable OSet # | Values appear in insertion order, not ascending order. | 
| Defined in Data.Set.Ordered Methods fold :: Monoid m => OSet m -> m # foldMap :: Monoid m => (a -> m) -> OSet a -> m # foldMap' :: Monoid m => (a -> m) -> OSet a -> m # foldr :: (a -> b -> b) -> b -> OSet a -> b # foldr' :: (a -> b -> b) -> b -> OSet a -> b # foldl :: (b -> a -> b) -> b -> OSet a -> b # foldl' :: (b -> a -> b) -> b -> OSet a -> b # foldr1 :: (a -> a -> a) -> OSet a -> a # foldl1 :: (a -> a -> a) -> OSet a -> a # elem :: Eq a => a -> OSet a -> Bool # maximum :: Ord a => OSet a -> a # | |
| (Data a, Ord a) => Data (OSet a) # | Since: 0.2 | 
| Defined in Data.Set.Ordered Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> OSet a -> c (OSet a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (OSet a) # toConstr :: OSet a -> Constr # dataTypeOf :: OSet a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (OSet a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (OSet a)) # gmapT :: (forall b. Data b => b -> b) -> OSet a -> OSet a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> OSet a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> OSet a -> r # gmapQ :: (forall d. Data d => d -> u) -> OSet a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> OSet a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> OSet a -> m (OSet a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> OSet a -> m (OSet a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> OSet a -> m (OSet a) # | |
| Ord a => IsList (OSet a) # | 
 Since: 0.2.4 | 
| (Ord a, Read a) => Read (OSet a) # | |
| Show a => Show (OSet a) # | |
| Eq a => Eq (OSet a) # | |
| Ord a => Ord (OSet a) # | |
| Hashable a => Hashable (OSet a) # | Since: 0.2.4 | 
| Defined in Data.Set.Ordered | |
| Ord a => Monoid (Bias L (OSet a)) # | Empty sets and set union. When combining two sets that share elements, the indices of the left argument are preferred. See the asymptotics of ( Since: 0.2 | 
| Ord a => Monoid (Bias R (OSet a)) # | Empty sets and set union. When combining two sets that share elements, the indices of the right argument are preferred. See the asymptotics of ( Since: 0.2 | 
| Ord a => Semigroup (Bias L (OSet a)) # | Since: 0.2 | 
| Ord a => Semigroup (Bias R (OSet a)) # | Since: 0.2 | 
| type Item (OSet a) # | |
| Defined in Data.Set.Ordered | |
Trivial sets
Insertion
Conventions:
- The open side of an angle bracket points to an OSet
- The pipe appears on the side whose indices take precedence for keys that appear on both sides
- The left argument's indices are lower than the right argument's indices
(<>|) :: Ord a => OSet a -> OSet a -> OSet a infixr 6 #
O(m*log(n)+n), where m is the size of the smaller set and n is the size of the larger set.
(|<>) :: Ord a => OSet a -> OSet a -> OSet a infixr 6 #
O(m*log(n)+n), where m is the size of the smaller set and n is the size of the larger set.
newtype Bias (dir :: IndexPreference) a #
A newtype to hang a Monoid instance on. The phantom first parameter
 tells whether mappend will prefer the indices of its first or second
 argument if there are shared elements in both.
Since: 0.2
Instances
| Functor (Bias dir) # | |
| Foldable (Bias dir) # | |
| Defined in Data.Map.Util Methods fold :: Monoid m => Bias dir m -> m # foldMap :: Monoid m => (a -> m) -> Bias dir a -> m # foldMap' :: Monoid m => (a -> m) -> Bias dir a -> m # foldr :: (a -> b -> b) -> b -> Bias dir a -> b # foldr' :: (a -> b -> b) -> b -> Bias dir a -> b # foldl :: (b -> a -> b) -> b -> Bias dir a -> b # foldl' :: (b -> a -> b) -> b -> Bias dir a -> b # foldr1 :: (a -> a -> a) -> Bias dir a -> a # foldl1 :: (a -> a -> a) -> Bias dir a -> a # elem :: Eq a => a -> Bias dir a -> Bool # maximum :: Ord a => Bias dir a -> a # minimum :: Ord a => Bias dir a -> a # | |
| Traversable (Bias dir) # | |
| (Ord k, Monoid v) => Monoid (Bias L (OMap k v)) # | Empty maps and map union. When combining two sets that share elements, the
 indices of the left argument are preferred, and the values are combined with
  See the asymptotics of  Since: 0.2 | 
| Ord a => Monoid (Bias L (OSet a)) # | Empty sets and set union. When combining two sets that share elements, the indices of the left argument are preferred. See the asymptotics of ( Since: 0.2 | 
| (Ord k, Monoid v) => Monoid (Bias R (OMap k v)) # | Empty maps and map union. When combining two sets that share elements, the
 indices of the right argument are preferred, and the values are combined
 with  See the asymptotics of  Since: 0.2 | 
| Ord a => Monoid (Bias R (OSet a)) # | Empty sets and set union. When combining two sets that share elements, the indices of the right argument are preferred. See the asymptotics of ( Since: 0.2 | 
| (Ord k, Semigroup v) => Semigroup (Bias L (OMap k v)) # | Uses the value-lazy variant of  Since: 0.2 | 
| Ord a => Semigroup (Bias L (OSet a)) # | Since: 0.2 | 
| (Ord k, Semigroup v) => Semigroup (Bias R (OMap k v)) # | Uses the value-lazy variant of  Since: 0.2 | 
| Ord a => Semigroup (Bias R (OSet a)) # | Since: 0.2 | 
| (Typeable dir, Data a) => Data (Bias dir a) # | |
| Defined in Data.Map.Util Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Bias dir a -> c (Bias dir a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Bias dir a) # toConstr :: Bias dir a -> Constr # dataTypeOf :: Bias dir a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Bias dir a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Bias dir a)) # gmapT :: (forall b. Data b => b -> b) -> Bias dir a -> Bias dir a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Bias dir a -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Bias dir a -> r # gmapQ :: (forall d. Data d => d -> u) -> Bias dir a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Bias dir a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Bias dir a -> m (Bias dir a) # | |
| Read a => Read (Bias dir a) # | |
| Show a => Show (Bias dir a) # | |
| Eq a => Eq (Bias dir a) # | |
| Ord a => Ord (Bias dir a) # | |
Query
Deletion
(\\) :: Ord a => OSet a -> OSet a -> OSet a #
Set difference: r \\ s deletes all the values in s from r. The
 order of r is unchanged.
O(m*log(n)) where m is the size of the smaller set and n is the size of the larger set.
(|/\) :: Ord a => OSet a -> OSet a -> OSet a #
Intersection. (/\ is meant to look a bit like the standard mathematical
 notation for intersection.)
O(m*log(n/(m+1)) + r*log(r)), where m is the size of the smaller set, n the size of the larger set, and r the size of the result.
Since: 0.2
Indexing
A 0-based index, much like the indices used by lists' !! operation. All
 indices are with respect to insertion order.
List conversions
fromList :: Ord a => [a] -> OSet a #
If a value occurs multiple times, only the first occurrence is used.
Returns values in ascending order. (Use toList to return them in
 insertion order.)