| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
PlutusCore.Name.Unique
Description
A Name is a datatype used to identify a variable inside the Plutus Core languages.
Name comparisons are a fundamental part of the domain logic, and comparing Text directly
is inefficient. As a solution to this problem, we provide the Unique type which is an
integer associated to the Name, unique to each instantiation of the type. We can,
therefore, compare the integers instead, which is obviously much more cost-effective.
We distinguish between the names of term variables and type variables by defining the
TyName wrapper over Name. Since the code we usually write is polymorphic in the
name type, we want to be able to define a class of names which have an associated Unique.
This class is HasUnique, see the definition below.
We use a newtype to enforce separation between names used for types and
those used for terms.
Instances
| Generic TyName # | |
Defined in PlutusCore.Name.Unique | |
Instances
| Foldable Named # | |
Defined in PlutusCore.Name.Unique Methods fold :: Monoid m => Named m -> m # foldMap :: Monoid m => (a -> m) -> Named a -> m # foldMap' :: Monoid m => (a -> m) -> Named a -> m # foldr :: (a -> b -> b) -> b -> Named a -> b # foldr' :: (a -> b -> b) -> b -> Named a -> b # foldl :: (b -> a -> b) -> b -> Named a -> b # foldl' :: (b -> a -> b) -> b -> Named a -> b # foldr1 :: (a -> a -> a) -> Named a -> a # foldl1 :: (a -> a -> a) -> Named a -> a # elem :: Eq a => a -> Named a -> Bool # maximum :: Ord a => Named a -> a # minimum :: Ord a => Named a -> a # | |
| Traversable Named # | |
| Functor Named # | |