Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Unique = Int
- class Uniquable a where
- data UniqMap a
- nullUniqMap :: UniqMap a -> Bool
- lookupUniqMap :: Uniquable a => a -> UniqMap b -> Maybe b
- lookupUniqMap' :: (HasCallStack, Uniquable a) => UniqMap b -> a -> b
- emptyUniqMap :: UniqMap a
- unitUniqMap :: Uniquable a => a -> b -> UniqMap b
- extendUniqMap :: Uniquable a => a -> b -> UniqMap b -> UniqMap b
- extendUniqMapWith :: Uniquable a => a -> b -> (b -> b -> b) -> UniqMap b -> UniqMap b
- extendListUniqMap :: Uniquable a => UniqMap b -> [(a, b)] -> UniqMap b
- delUniqMap :: Uniquable a => UniqMap b -> a -> UniqMap b
- delListUniqMap :: Uniquable a => UniqMap b -> [a] -> UniqMap b
- unionUniqMap :: UniqMap a -> UniqMap a -> UniqMap a
- unionUniqMapWith :: (a -> a -> a) -> UniqMap a -> UniqMap a -> UniqMap a
- differenceUniqMap :: UniqMap a -> UniqMap a -> UniqMap a
- mapUniqMap :: (a -> b) -> UniqMap a -> UniqMap b
- mapMaybeUniqMap :: (a -> Maybe b) -> UniqMap a -> UniqMap b
- filterUniqMap :: (b -> Bool) -> UniqMap b -> UniqMap b
- elemUniqMap :: Uniquable a => a -> UniqMap b -> Bool
- notElemUniqMap :: Uniquable a => a -> UniqMap b -> Bool
- foldrWithUnique :: (Unique -> a -> b -> b) -> b -> UniqMap a -> b
- eltsUniqMap :: UniqMap a -> [a]
- keysUniqMap :: UniqMap a -> [Unique]
- listToUniqMap :: Uniquable a => [(a, b)] -> UniqMap b
- toListUniqMap :: UniqMap a -> [(Unique, a)]
- uniqMapToUniqSet :: UniqMap a -> UniqSet a
- data UniqSet a
- lookupUniqSet :: Uniquable a => a -> UniqSet b -> Maybe b
- emptyUniqSet :: UniqSet a
- unitUniqSet :: Uniquable a => a -> UniqSet a
- extendUniqSet :: Uniquable a => UniqSet a -> a -> UniqSet a
- unionUniqSet :: UniqSet a -> UniqSet a -> UniqSet a
- delUniqSetDirectly :: Unique -> UniqSet b -> UniqSet b
- elemUniqSet :: Uniquable a => a -> UniqSet a -> Bool
- notElemUniqSet :: Uniquable a => a -> UniqSet a -> Bool
- elemUniqSetDirectly :: Unique -> UniqSet a -> Bool
- subsetUniqSet :: UniqSet a -> UniqSet a -> Bool
- mkUniqSet :: Uniquable a => [a] -> UniqSet a
- eltsUniqSet :: UniqSet a -> [a]
Unique
UniqMap
Map indexed by a Uniquable
key
Instances
Functor UniqMap Source # | |
Foldable UniqMap Source # | |
Defined in Clash.Unique fold :: Monoid m => UniqMap m -> m # foldMap :: Monoid m => (a -> m) -> UniqMap a -> m # foldMap' :: Monoid m => (a -> m) -> UniqMap a -> m # foldr :: (a -> b -> b) -> b -> UniqMap a -> b # foldr' :: (a -> b -> b) -> b -> UniqMap a -> b # foldl :: (b -> a -> b) -> b -> UniqMap a -> b # foldl' :: (b -> a -> b) -> b -> UniqMap a -> b # foldr1 :: (a -> a -> a) -> UniqMap a -> a # foldl1 :: (a -> a -> a) -> UniqMap a -> a # elem :: Eq a => a -> UniqMap a -> Bool # maximum :: Ord a => UniqMap a -> a # minimum :: Ord a => UniqMap a -> a # | |
Traversable UniqMap Source # | |
ClashPretty a => Show (UniqMap a) Source # | |
Semigroup (UniqMap a) Source # | |
Monoid (UniqMap a) Source # | |
Binary a => Binary (UniqMap a) Source # | |
NFData a => NFData (UniqMap a) Source # | |
Defined in Clash.Unique | |
ClashPretty a => ClashPretty (UniqMap a) Source # | |
Defined in Clash.Unique clashPretty :: UniqMap a -> Doc () Source # |
Accessors
Size information
nullUniqMap :: UniqMap a -> Bool Source #
Check whether the map is empty
Indexing
lookupUniqMap' :: (HasCallStack, Uniquable a) => UniqMap b -> a -> b Source #
Like lookupUniqMap'
, but errors out when the key is not present
Construction
emptyUniqMap :: UniqMap a Source #
The empty map
unitUniqMap :: Uniquable a => a -> b -> UniqMap b Source #
Map with a single key-value pair
Modification
extendUniqMap :: Uniquable a => a -> b -> UniqMap b -> UniqMap b Source #
Extend the map with a new key-value pair. If the key already exists in the associated value will be overwritten
extendUniqMapWith :: Uniquable a => a -> b -> (b -> b -> b) -> UniqMap b -> UniqMap b Source #
Extend the map with a new key-value pair. If the key already exists in the associated value will be combined with the new value using the function provided
extendListUniqMap :: Uniquable a => UniqMap b -> [(a, b)] -> UniqMap b Source #
Extend the map with a list of key-value pairs. Positions with existing keys will be overwritten with the new values
delUniqMap :: Uniquable a => UniqMap b -> a -> UniqMap b Source #
Remove a key-value pair from the map
delListUniqMap :: Uniquable a => UniqMap b -> [a] -> UniqMap b Source #
Remove a list of key-value pairs from the map
unionUniqMapWith :: (a -> a -> a) -> UniqMap a -> UniqMap a -> UniqMap a Source #
A union of two maps, key-value pairs with the same key will be merged using the given function
differenceUniqMap :: UniqMap a -> UniqMap a -> UniqMap a Source #
Get the difference between two maps
Element-wise operations
Mapping
mapUniqMap :: (a -> b) -> UniqMap a -> UniqMap b Source #
Apply a function to every element in the map
mapMaybeUniqMap :: (a -> Maybe b) -> UniqMap a -> UniqMap b Source #
Apply a function to every element in the map. When the function returns
Nothing
, the key-value pair will be removed
Working with predicates
Filtering
filterUniqMap :: (b -> Bool) -> UniqMap b -> UniqMap b Source #
Derive a map where all the elements adhere to the predicate
Searching
notElemUniqMap :: Uniquable a => a -> UniqMap b -> Bool Source #
Check whether a key is not in the map
Folding
foldrWithUnique :: (Unique -> a -> b -> b) -> b -> UniqMap a -> b Source #
Right-fold over a map using both the key and value
Conversions
Lists
eltsUniqMap :: UniqMap a -> [a] Source #
Extract the elements of a map into a list
keysUniqMap :: UniqMap a -> [Unique] Source #
Extract the keys of a map into a list
listToUniqMap :: Uniquable a => [(a, b)] -> UniqMap b Source #
Convert a list of key-value pairs to a map
toListUniqMap :: UniqMap a -> [(Unique, a)] Source #
Convert a map to a list of key-value pairs
UniqSet
UniqSet
Set of things that have a Unique
Invariant: they keys in the map are the uniques of the values
Instances
Foldable UniqSet Source # | |
Defined in Clash.Unique fold :: Monoid m => UniqSet m -> m # foldMap :: Monoid m => (a -> m) -> UniqSet a -> m # foldMap' :: Monoid m => (a -> m) -> UniqSet a -> m # foldr :: (a -> b -> b) -> b -> UniqSet a -> b # foldr' :: (a -> b -> b) -> b -> UniqSet a -> b # foldl :: (b -> a -> b) -> b -> UniqSet a -> b # foldl' :: (b -> a -> b) -> b -> UniqSet a -> b # foldr1 :: (a -> a -> a) -> UniqSet a -> a # foldl1 :: (a -> a -> a) -> UniqSet a -> a # elem :: Eq a => a -> UniqSet a -> Bool # maximum :: Ord a => UniqSet a -> a # minimum :: Ord a => UniqSet a -> a # | |
Semigroup (UniqSet a) Source # | |
Monoid (UniqSet a) Source # | |
Binary a => Binary (UniqSet a) Source # | |
ClashPretty a => ClashPretty (UniqSet a) Source # | |
Defined in Clash.Unique clashPretty :: UniqSet a -> Doc () Source # |
Accessors
Indexing
lookupUniqSet :: Uniquable a => a -> UniqSet b -> Maybe b Source #
Look up an element in the set, returns it if it exists
Construction
emptyUniqSet :: UniqSet a Source #
The empty set
unitUniqSet :: Uniquable a => a -> UniqSet a Source #
Set with a single element
Modifications
delUniqSetDirectly :: Unique -> UniqSet b -> UniqSet b Source #
Remove an element based on the Unique
it contains
Working with predicates
Searching
elemUniqSet :: Uniquable a => a -> UniqSet a -> Bool Source #
Check whether an element exists in the set
notElemUniqSet :: Uniquable a => a -> UniqSet a -> Bool Source #
Check whether an element does not exist in the set
elemUniqSetDirectly :: Unique -> UniqSet a -> Bool Source #
Check whether an element exists in the set based on the Unique
contained
in that element
Misc
Conversions
Lists
mkUniqSet :: Uniquable a => [a] -> UniqSet a Source #
Create a set out of a list of elements that contain a Unique
eltsUniqSet :: UniqSet a -> [a] Source #
Get the elements of the set as a list