bcp47-0.1.0.0: Language tags as specified by BCP 47

Safe HaskellNone
LanguageHaskell2010

Data.BCP47.Trie

Description

A trie like data structure for defining maps from BCP47 tags to values.

This structure supports collection and lookup of language tagged values. Its semantics are based on those defined in the BCP 47 specification.

Synopsis

Documentation

data Trie a Source #

A trie mapping BCP47 tags to values

Instances
Functor Trie Source # 
Instance details

Defined in Data.BCP47.Trie.Internal

Methods

fmap :: (a -> b) -> Trie a -> Trie b #

(<$) :: a -> Trie b -> Trie a #

Foldable Trie Source # 
Instance details

Defined in Data.BCP47.Trie.Internal

Methods

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

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

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

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

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

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

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

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

toList :: Trie a -> [a] #

null :: Trie a -> Bool #

length :: Trie a -> Int #

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

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

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

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

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

Traversable Trie Source # 
Instance details

Defined in Data.BCP47.Trie.Internal

Methods

traverse :: Applicative f => (a -> f b) -> Trie a -> f (Trie b) #

sequenceA :: Applicative f => Trie (f a) -> f (Trie a) #

mapM :: Monad m => (a -> m b) -> Trie a -> m (Trie b) #

sequence :: Monad m => Trie (m a) -> m (Trie a) #

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

Defined in Data.BCP47.Trie.Internal

Methods

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

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

Ord a => Ord (Trie a) Source # 
Instance details

Defined in Data.BCP47.Trie.Internal

Methods

compare :: Trie a -> Trie a -> Ordering #

(<) :: Trie a -> Trie a -> Bool #

(<=) :: Trie a -> Trie a -> Bool #

(>) :: Trie a -> Trie a -> Bool #

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

max :: Trie a -> Trie a -> Trie a #

min :: Trie a -> Trie a -> Trie a #

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

Defined in Data.BCP47.Trie.Internal

Methods

showsPrec :: Int -> Trie a -> ShowS #

show :: Trie a -> String #

showList :: [Trie a] -> ShowS #

Semigroup a => Semigroup (Trie a) Source # 
Instance details

Defined in Data.BCP47.Trie.Internal

Methods

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

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

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

Semigroup a => Monoid (Trie a) Source # 
Instance details

Defined in Data.BCP47.Trie.Internal

Methods

mempty :: Trie a #

mappend :: Trie a -> Trie a -> Trie a #

mconcat :: [Trie a] -> Trie a #

Arbitrary a => Arbitrary (Trie a) Source # 
Instance details

Defined in Data.BCP47.Trie.Internal

Methods

arbitrary :: Gen (Trie a) #

shrink :: Trie a -> [Trie a] #

fromList :: [(BCP47, a)] -> Trie a Source #

Construct a Trie from a list of tag/value pairs.

singleton :: BCP47 -> a -> Trie a Source #

Construct a Trie from a single tag/value pair.

lookup :: BCP47 -> Trie a -> Maybe a Source #

Lookup the most relevant item for a tag

match :: BCP47 -> Trie a -> Maybe a Source #

Lookup an exact match for a tag

elem :: BCP47 -> Trie a -> Bool Source #

Check if a tag exists in the Trie

union :: Trie a -> Trie a -> Trie a Source #

A left-biased union of two Trie structures. The left value is prefered when duplicate tags are found.

unionWith :: (a -> a -> a) -> Trie a -> Trie a -> Trie a Source #

union with a combining function.

null :: Trie a -> Bool Source #

Check if a Trie is empty