Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype UniqueMap unique a = UniqueMap {
- unUniqueMap ∷ IntMap a
- insertByUnique ∷ Coercible unique Unique ⇒ unique → a → UniqueMap unique a → UniqueMap unique a
- insertByName ∷ HasUnique name unique ⇒ name → a → UniqueMap unique a → UniqueMap unique a
- singletonByName ∷ HasUnique name unique ⇒ name → a → UniqueMap unique a
- insertNamed ∷ (HasText name, HasUnique name unique) ⇒ name → a → UniqueMap unique (Named a) → UniqueMap unique (Named a)
- insertByNameIndex ∷ (HasUnique name unique1, Coercible unique2 Unique) ⇒ name → a → UniqueMap unique2 a → UniqueMap unique2 a
- fromFoldable ∷ Foldable f ⇒ (i → a → UniqueMap unique a → UniqueMap unique a) → f (i, a) → UniqueMap unique a
- fromUniques ∷ Foldable f ⇒ Coercible Unique unique ⇒ f (unique, a) → UniqueMap unique a
- fromNames ∷ Foldable f ⇒ HasUnique name unique ⇒ f (name, a) → UniqueMap unique a
- lookupUnique ∷ Coercible unique Unique ⇒ unique → UniqueMap unique a → Maybe a
- lookupName ∷ HasUnique name unique ⇒ name → UniqueMap unique a → Maybe a
- restrictKeys ∷ UniqueMap unique v → UniqueSet unique → UniqueMap unique v
- lookupNameIndex ∷ (HasUnique name unique1, Coercible unique2 Unique) ⇒ name → UniqueMap unique2 a → Maybe a
Documentation
newtype UniqueMap unique a Source #
A mapping from Unique
s 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.
Instances
Foldable (UniqueMap unique) Source # | |
Defined in PlutusCore.Name.UniqueMap 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 # | |
Functor (UniqueMap unique) Source # | |
Monoid (UniqueMap unique a) Source # | |
Semigroup (UniqueMap unique a) Source # | |
Show a ⇒ Show (UniqueMap unique a) Source # | |
Eq a ⇒ Eq (UniqueMap unique a) 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 #
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.
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.