charon-0.1: Template
Safe HaskellSafe-Inferred
LanguageGHC2021

Charon.Data.UniqueSeq

Description

Provides the UniqueSeq type.

Synopsis

Documentation

data UniqueSeq a where Source #

Like Seq but with the guarantee that all elements are unique. This comes with the cost of O(2n) space.

Bundled Patterns

pattern MkUniqueSeq :: Seq a -> HashSet a -> UniqueSeq a 

Instances

Instances details
Foldable UniqueSeq Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Methods

fold :: Monoid m => UniqueSeq m -> m #

foldMap :: Monoid m => (a -> m) -> UniqueSeq a -> m #

foldMap' :: Monoid m => (a -> m) -> UniqueSeq a -> m #

foldr :: (a -> b -> b) -> b -> UniqueSeq a -> b #

foldr' :: (a -> b -> b) -> b -> UniqueSeq a -> b #

foldl :: (b -> a -> b) -> b -> UniqueSeq a -> b #

foldl' :: (b -> a -> b) -> b -> UniqueSeq a -> b #

foldr1 :: (a -> a -> a) -> UniqueSeq a -> a #

foldl1 :: (a -> a -> a) -> UniqueSeq a -> a #

toList :: UniqueSeq a -> [a] #

null :: UniqueSeq a -> Bool #

length :: UniqueSeq a -> Int #

elem :: Eq a => a -> UniqueSeq a -> Bool #

maximum :: Ord a => UniqueSeq a -> a #

minimum :: Ord a => UniqueSeq a -> a #

sum :: Num a => UniqueSeq a -> a #

product :: Num a => UniqueSeq a -> a #

(k ~ A_Getter, b ~ Seq a, c ~ Seq a) => LabelOptic "seq" k (UniqueSeq a) (UniqueSeq a) b c Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Methods

labelOptic :: Optic k NoIx (UniqueSeq a) (UniqueSeq a) b c Source #

(k ~ A_Getter, b ~ HashSet a, c ~ HashSet a) => LabelOptic "set" k (UniqueSeq a) (UniqueSeq a) b c Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Methods

labelOptic :: Optic k NoIx (UniqueSeq a) (UniqueSeq a) b c Source #

Hashable a => Monoid (UniqueSeq a) Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Hashable a => Semigroup (UniqueSeq a) Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Methods

(<>) :: UniqueSeq a -> UniqueSeq a -> UniqueSeq a #

sconcat :: NonEmpty (UniqueSeq a) -> UniqueSeq a #

stimes :: Integral b => b -> UniqueSeq a -> UniqueSeq a #

Hashable a => IsList (UniqueSeq a) Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Associated Types

type Item (UniqueSeq a) #

Methods

fromList :: [Item (UniqueSeq a)] -> UniqueSeq a #

fromListN :: Int -> [Item (UniqueSeq a)] -> UniqueSeq a #

toList :: UniqueSeq a -> [Item (UniqueSeq a)] #

Show a => Show (UniqueSeq a) Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Eq a => Eq (UniqueSeq a) Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

Methods

(==) :: UniqueSeq a -> UniqueSeq a -> Bool #

(/=) :: UniqueSeq a -> UniqueSeq a -> Bool #

type Item (UniqueSeq a) Source # 
Instance details

Defined in Charon.Data.UniqueSeq.Internal

type Item (UniqueSeq a) = a

Creation

Lookup

member :: Hashable a => a -> UniqueSeq a -> Bool Source #

(∈) :: Hashable a => a -> UniqueSeq a -> Bool infix 4 Source #

Operator alias for member. U+2216.

Since: 0.1

(∉) :: Hashable a => a -> UniqueSeq a -> Bool infix 4 Source #

Negation of (∈). U+2209.

Since: 0.1

Operations

union :: forall a. Hashable a => UniqueSeq a -> UniqueSeq a -> UniqueSeq a Source #

(∪) :: Hashable a => UniqueSeq a -> UniqueSeq a -> UniqueSeq a infixl 6 Source #

Operator alias for union. U+222A.

Since: 0.1

(⋃) :: (Foldable f, Hashable a) => f (UniqueSeq a) -> UniqueSeq a Source #

Fold over union. U+22C3.

Since: 0.1

map :: Hashable b => (a -> b) -> UniqueSeq a -> UniqueSeq b Source #

(↤) :: Hashable b => (a -> b) -> UniqueSeq a -> UniqueSeq b infix 3 Source #

Operator alias for map. U+21A4.

Since: 0.1

(↦) :: Hashable b => UniqueSeq a -> (a -> b) -> UniqueSeq b infix 3 Source #

Flipped (↤). U+21A6.

Since: 0.1

Display

display :: (a -> Text) -> UniqueSeq a -> Text Source #