clash-lib-1.8.4: Clash: a functional hardware description language - As a library

Safe Haskell | None
Language | Haskell2010

Clash.Data.UniqMap

Synopsis

- newtype UniqMap a = UniqMap {
  - uniqMapToIntMap :: Word64Map a
  }
- empty :: UniqMap a
- singleton :: Uniquable a => a -> b -> UniqMap b
- singletonUnique :: Uniquable a => a -> UniqMap a
- null :: UniqMap a -> Bool
- insert :: Uniquable a => a -> b -> UniqMap b -> UniqMap b
- insertUnique :: Uniquable a => a -> UniqMap a -> UniqMap a
- insertWith :: Uniquable a => (b -> b -> b) -> a -> b -> UniqMap b -> UniqMap b
- insertMany :: Uniquable a => [(a, b)] -> UniqMap b -> UniqMap b
- lookup :: Uniquable a => a -> UniqMap b -> Maybe b
- find :: Uniquable a => a -> UniqMap b -> b
- elem :: Uniquable a => a -> UniqMap b -> Bool
- notElem :: Uniquable a => a -> UniqMap b -> Bool
- filter :: (b -> Bool) -> UniqMap b -> UniqMap b
- mapMaybe :: (a -> Maybe b) -> UniqMap a -> UniqMap b
- foldrWithUnique :: (Unique -> a -> b -> b) -> b -> UniqMap a -> b
- foldlWithUnique' :: (b -> Unique -> a -> b) -> b -> UniqMap a -> b
- delete :: Uniquable a => a -> UniqMap b -> UniqMap b
- deleteMany :: Uniquable a => [a] -> UniqMap b -> UniqMap b
- unionWith :: (b -> b -> b) -> UniqMap b -> UniqMap b -> UniqMap b
- difference :: UniqMap b -> UniqMap b -> UniqMap b
- disjoint :: UniqMap b -> UniqMap b -> Bool
- submap :: UniqMap b -> UniqMap b -> Bool
- fromList :: Uniquable a => [(a, b)] -> UniqMap b
- toList :: UniqMap b -> [(Unique, b)]
- keys :: UniqMap b -> [Unique]
- elems :: UniqMap b -> [b]

# Documentation

newtype UniqMap a Source #

A map indexed by a `Unique`. Typically the elements of this map are also uniqueable and provide their own key, however a unique can be associated with any value.

Constructors

UniqMap |

Fields

- uniqMapToIntMap :: Word64Map a

#### Instances

Instances details

Functor UniqMap Source # |
Instance details Defined in Clash.Data.UniqMap Methods fmap :: (a -> b) -> UniqMap a -> UniqMap b Source # (<$) :: a -> UniqMap b -> UniqMap a Source #
Foldable UniqMap Source # |

Instance details

Defined in Clash.Data.UniqMap

Methods

fold :: Monoid m => UniqMap m -> m Source #

foldMap :: Monoid m => (a -> m) -> UniqMap a -> m Source #

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

foldr :: (a -> b -> b) -> b -> UniqMap a -> b Source #

foldr' :: (a -> b -> b) -> b -> UniqMap a -> b Source #

foldl :: (b -> a -> b) -> b -> UniqMap a -> b Source #

foldl' :: (b -> a -> b) -> b -> UniqMap a -> b Source #

foldr1 :: (a -> a -> a) -> UniqMap a -> a Source #

foldl1 :: (a -> a -> a) -> UniqMap a -> a Source #

toList :: UniqMap a -> [a] Source #

null :: UniqMap a -> Bool Source #

length :: UniqMap a -> Int Source #

elem :: Eq a => a -> UniqMap a -> Bool Source #

maximum :: Ord a => UniqMap a -> a Source #

minimum :: Ord a => UniqMap a -> a Source #

sum :: Num a => UniqMap a -> a Source #

product :: Num a => UniqMap a -> a Source #

Traversable UniqMap Source # |
Instance details Defined in Clash.Data.UniqMap Methods traverse :: Applicative f => (a -> f b) -> UniqMap a -> f (UniqMap b) Source # sequenceA :: Applicative f => UniqMap (f a) -> f (UniqMap a) Source # mapM :: Monad m => (a -> m b) -> UniqMap a -> m (UniqMap b) Source # sequence :: Monad m => UniqMap (m a) -> m (UniqMap a) Source #
Binary a => Binary (UniqMap a) Source # |
Instance details Defined in Clash.Data.UniqMap Methods put :: UniqMap a -> Put Source # get :: Get (UniqMap a) Source # putList :: [UniqMap a] -> Put Source #
ClashPretty a => ClashPretty (UniqMap a) Source # |
Instance details Defined in Clash.Data.UniqMap Methods clashPretty :: UniqMap a -> Doc () Source #
NFData a => NFData (UniqMap a) Source # |
Instance details Defined in Clash.Data.UniqMap Methods rnf :: UniqMap a -> () Source #
Monoid (UniqMap a) Source # |
Instance details Defined in Clash.Data.UniqMap Methods mempty :: UniqMap a Source # mappend :: UniqMap a -> UniqMap a -> UniqMap a Source # mconcat :: [UniqMap a] -> UniqMap a Source #
Semigroup (UniqMap a) Source # |
Instance details Defined in Clash.Data.UniqMap Methods (<>) :: UniqMap a -> UniqMap a -> UniqMap a Source # sconcat :: NonEmpty (UniqMap a) -> UniqMap a Source # stimes :: Integral b => b -> UniqMap a -> UniqMap a Source #
Show a => Show (UniqMap a) Source # |
Instance details Defined in Clash.Data.UniqMap Methods showsPrec :: Int -> UniqMap a -> ShowS Source # show :: UniqMap a -> String Source # showList :: [UniqMap a] -> ShowS Source #

empty :: UniqMap a Source #

An empty map.

singleton :: Uniquable a => a -> b -> UniqMap b Source #

A map containing a single value indexed by the given key's unique.

singletonUnique :: Uniquable a => a -> UniqMap a Source #

A map containing a single value indexed by the value's unique.

null :: UniqMap a -> Bool Source #

Check if the map is empty.

insert :: Uniquable a => a -> b -> UniqMap b -> UniqMap b Source #

Insert a new key-value pair into the map.

insertUnique :: Uniquable a => a -> UniqMap a -> UniqMap a Source #

Insert a new value into the map, using the unique of the value as the key.

insertWith :: Uniquable a => (b -> b -> b) -> a -> b -> UniqMap b -> UniqMap b Source #

Insert a new key-value pair into the map, using the given combining function if there is already an entry with the same unique in the map.

insertMany :: Uniquable a => [(a, b)] -> UniqMap b -> UniqMap b Source #

Insert a list of key-value pairs into the map.

lookup :: Uniquable a => a -> UniqMap b -> Maybe b Source #

Lookup an item in the map, using the unique of the given key.

find :: Uniquable a => a -> UniqMap b -> b Source #

Lookup and item in the map, using the unique of the given key. If the item is not found in the map an error is raised.

elem :: Uniquable a => a -> UniqMap b -> Bool Source #

Check if there is an entry in the map for the unique of the given value.

notElem :: Uniquable a => a -> UniqMap b -> Bool Source #

Check if there is not an entry in the map for the unique of the given value.

filter :: (b -> Bool) -> UniqMap b -> UniqMap b Source #

Filter all elements in the map according to some predicate.

mapMaybe :: (a -> Maybe b) -> UniqMap a -> UniqMap b Source #

Apply a function to all elements in the map, keeping those where the result is not `Nothing`.

foldrWithUnique :: (Unique -> a -> b -> b) -> b -> UniqMap a -> b Source #

Lazily right-fold over the map using the given function.

foldlWithUnique' :: (b -> Unique -> a -> b) -> b -> UniqMap a -> b Source #

Strictly left-fold over the map using the given function.

delete :: Uniquable a => a -> UniqMap b -> UniqMap b Source #

Delete the entry in the map indexed by the unique of the given value.

deleteMany :: Uniquable a => [a] -> UniqMap b -> UniqMap b Source #

Delete all entries in the map indexed by the uniques of the given values.

unionWith :: (b -> b -> b) -> UniqMap b -> UniqMap b -> UniqMap b Source #

Merge two unique maps, using the given combining funcion if a value with the same unique key exists in both maps.

difference :: UniqMap b -> UniqMap b -> UniqMap b Source #

Filter the first map to only contain keys which are not in the second map.

disjoint :: UniqMap b -> UniqMap b -> Bool Source #

Check if there are no common keys between two maps.

submap :: UniqMap b -> UniqMap b -> Bool Source #

Check if one map is a submap of another.

fromList :: Uniquable a => [(a, b)] -> UniqMap b Source #

Convert a list of key-value pairs to a map.

toList :: UniqMap b -> [(Unique, b)] Source #

Convert a map to a list of unique-value pairs.

keys :: UniqMap b -> [Unique] Source #

Get the unique keys of a map.

elems :: UniqMap b -> [b] Source #

Get the values of a map.