plutus-core-1.36.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Name.UniqueMap

Description

A type for maps (key-value associations), where the key type can be identified by Uniques. In practice, these types are usually names. This approach is preferred when it is more efficient to compare the associated Uniques instead of the underlying type.

Synopsis

Documentation

newtype UniqueMap unique a Source #

A mapping from Uniques to arbitrary values of type a. Since Unique is equivalent to Int (see PlutusCore.Name.Unique), we can use an IntMap representation for this type.

Constructors

UniqueMap 

Fields

Instances

Instances details
Foldable (UniqueMap unique) Source # 
Instance details

Defined in PlutusCore.Name.UniqueMap

Methods

fold :: Monoid m => UniqueMap unique m -> m Source #

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

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

foldr :: (a -> b -> b) -> b -> UniqueMap unique a -> b Source #

foldr' :: (a -> b -> b) -> b -> UniqueMap unique a -> b Source #

foldl :: (b -> a -> b) -> b -> UniqueMap unique a -> b Source #

foldl' :: (b -> a -> b) -> b -> UniqueMap unique a -> b Source #

foldr1 :: (a -> a -> a) -> UniqueMap unique a -> a Source #

foldl1 :: (a -> a -> a) -> UniqueMap unique a -> a Source #

toList :: UniqueMap unique a -> [a] Source #

null :: UniqueMap unique a -> Bool Source #

length :: UniqueMap unique a -> Int Source #

elem :: Eq a => a -> UniqueMap unique a -> Bool Source #

maximum :: Ord a => UniqueMap unique a -> a Source #

minimum :: Ord a => UniqueMap unique a -> a Source #

sum :: Num a => UniqueMap unique a -> a Source #

product :: Num a => UniqueMap unique a -> a Source #

Functor (UniqueMap unique) Source # 
Instance details

Defined in PlutusCore.Name.UniqueMap

Methods

fmap :: (a -> b) -> UniqueMap unique a -> UniqueMap unique b Source #

(<$) :: a -> UniqueMap unique b -> UniqueMap unique a Source #

Monoid (UniqueMap unique a) Source # 
Instance details

Defined in PlutusCore.Name.UniqueMap

Methods

mempty :: UniqueMap unique a Source #

mappend :: UniqueMap unique a -> UniqueMap unique a -> UniqueMap unique a Source #

mconcat :: [UniqueMap unique a] -> UniqueMap unique a Source #

Semigroup (UniqueMap unique a) Source # 
Instance details

Defined in PlutusCore.Name.UniqueMap

Methods

(<>) :: UniqueMap unique a -> UniqueMap unique a -> UniqueMap unique a Source #

sconcat :: NonEmpty (UniqueMap unique a) -> UniqueMap unique a Source #

stimes :: Integral b => b -> UniqueMap unique a -> UniqueMap unique a Source #

Show a => Show (UniqueMap unique a) Source # 
Instance details

Defined in PlutusCore.Name.UniqueMap

Methods

showsPrec :: Int -> UniqueMap unique a -> ShowS Source #

show :: UniqueMap unique a -> String Source #

showList :: [UniqueMap unique a] -> ShowS Source #

Eq a => Eq (UniqueMap unique a) Source # 
Instance details

Defined in PlutusCore.Name.UniqueMap

Methods

(==) :: UniqueMap unique a -> UniqueMap unique a -> Bool Source #

(/=) :: UniqueMap unique a -> UniqueMap unique a -> Bool Source #

insertByUnique :: Coercible unique Unique => unique -> a -> UniqueMap unique a -> UniqueMap unique a Source #

Insert a value a by a unique.

insertByName :: HasUnique name unique => name -> a -> UniqueMap unique a -> UniqueMap unique a Source #

Insert a value a by the unique of a name.

singletonByName :: HasUnique name unique => name -> a -> UniqueMap unique a Source #

Create the singleton map of the unique of a name and a value a.

insertNamed :: (HasText name, HasUnique name unique) => name -> a -> UniqueMap unique (Named a) -> UniqueMap unique (Named a) Source #

Insert a named value a by the index of the unique of the name.

insertByNameIndex :: (HasUnique name unique1, Coercible unique2 Unique) => name -> a -> UniqueMap unique2 a -> UniqueMap unique2 a Source #

Insert a value by the index of the unique of a name. Unlike insertByUnique and insertByName, this function does not provide any static guarantees, so you can for example insert by a type-level name in a map from term-level uniques.

fromFoldable :: Foldable f => (i -> a -> UniqueMap unique a -> UniqueMap unique a) -> f (i, a) -> UniqueMap unique a Source #

Convert a Foldable into a UniqueMap using the given insertion function.

fromUniques :: Foldable f => Coercible Unique unique => f (unique, a) -> UniqueMap unique a Source #

Convert a Foldable with uniques into a UniqueMap.

fromNames :: Foldable f => HasUnique name unique => f (name, a) -> UniqueMap unique a Source #

Convert a Foldable with names into a UniqueMap.

lookupUnique :: Coercible unique Unique => unique -> UniqueMap unique a -> Maybe a Source #

Look up a value by a unique.

lookupName :: HasUnique name unique => name -> UniqueMap unique a -> Maybe a Source #

Look up a value by the unique of a name.

restrictKeys :: UniqueMap unique v -> UniqueSet unique -> UniqueMap unique v Source #

lookupNameIndex :: (HasUnique name unique1, Coercible unique2 Unique) => name -> UniqueMap unique2 a -> Maybe a Source #

Look up a value by the index of the unique of a name. Unlike lookupUnique and lookupName, this function does not provide any static guarantees, so you can for example look up a type-level name in a map from term-level uniques.