Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Name = Name {
- nameString :: Text
- nameUnique :: Unique
- newtype TyName = TyName {}
- newtype Unique = Unique {}
- newtype TypeUnique = TypeUnique {}
- newtype TermUnique = TermUnique {}
- class Coercible unique Unique => HasUnique a unique | a -> unique where
- theUnique :: HasUnique name unique => Lens' name Unique
- 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
- 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
- lookupNameIndex :: (HasUnique name unique1, Coercible unique2 Unique) => name -> UniqueMap unique2 a -> Maybe a
- mapNameString :: (Text -> Text) -> Name -> Name
- mapTyNameString :: (Text -> Text) -> TyName -> TyName
- isEmpty :: UniqueMap unique a -> Bool
Types
A Name
represents variables/names in Plutus Core.
Name | |
|
Instances
Eq Name Source # | |
Ord Name Source # | |
Show Name Source # | |
Generic Name Source # | |
NFData Name Source # | |
Defined in PlutusCore.Name | |
Hashable Name Source # | |
Defined in PlutusCore.Name | |
ToScopedName Name Source # | |
Defined in PlutusCore.Check.Scoping toScopedName :: Name -> ScopedName Source # | |
Flat Name | |
Lift Name Source # | |
HasPrettyConfigName config => PrettyBy config Name Source # | |
Defined in PlutusCore.Name | |
HasUnique Name TermUnique Source # | |
Defined in PlutusCore.Name | |
name ~ Name => Reference Name (Term tyname name uni fun) Source # | |
Defined in PlutusCore.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> Name -> Term tyname name uni fun NameAnn -> Term tyname name uni fun NameAnn Source # | |
name ~ Name => Reference Name (Term tyname name uni fun) Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> Name -> Term tyname name uni fun NameAnn -> Term tyname name uni fun NameAnn Source # | |
name ~ Name => Reference Name (Binding tyname name uni fun) Source # | Unlike other |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> Name -> Binding tyname name uni fun NameAnn -> Binding tyname name uni fun NameAnn Source # | |
Flat (Binder Name) | |
AsTypeError (Error uni fun ann) (Term TyName Name uni fun ()) uni fun ann Source # | |
Defined in PlutusCore.Error _TypeError :: Prism' (Error uni fun ann) (TypeError (Term TyName Name uni fun ()) uni fun ann) Source # _KindMismatch :: Prism' (Error uni fun ann) (ann, Type TyName uni (), Kind (), Kind ()) Source # _TypeMismatch :: Prism' (Error uni fun ann) (ann, Term TyName Name uni fun (), Type TyName uni (), Normalized (Type TyName uni ())) Source # _FreeTypeVariableE :: Prism' (Error uni fun ann) (ann, TyName) Source # _FreeVariableE :: Prism' (Error uni fun ann) (ann, Name) Source # _UnknownBuiltinFunctionE :: Prism' (Error uni fun ann) (ann, fun) Source # | |
AsTypeError (Error uni fun a) (Term TyName Name uni fun ()) uni fun a Source # | |
Defined in PlutusIR.Error _TypeError :: Prism' (Error uni fun a) (TypeError (Term TyName Name uni fun ()) uni fun a) Source # _KindMismatch :: Prism' (Error uni fun a) (a, Type TyName uni (), Kind (), Kind ()) Source # _TypeMismatch :: Prism' (Error uni fun a) (a, Term TyName Name uni fun (), Type TyName uni (), Normalized (Type TyName uni ())) Source # _FreeTypeVariableE :: Prism' (Error uni fun a) (a, TyName) Source # _FreeVariableE :: Prism' (Error uni fun a) (a, Name) Source # _UnknownBuiltinFunctionE :: Prism' (Error uni fun a) (a, fun) Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term Name uni fun ann) Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term TyName Name uni fun ann) Source # | |
HasConstant (Term TyName Name uni fun ()) Source # | |
Defined in PlutusCore.Builtin.HasConstant | |
(Reference TyName t, Reference Name t) => Reference (Binding TyName Name uni fun ann) t Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> Binding TyName Name uni fun ann -> t NameAnn -> t NameAnn Source # | |
(Reference TyName t, Reference Name t) => Reference (Datatype TyName Name uni fun ann) t Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> Datatype TyName Name uni fun ann -> t NameAnn -> t NameAnn Source # | |
type Rep Name Source # | |
Defined in PlutusCore.Name type Rep Name = D1 ('MetaData "Name" "PlutusCore.Name" "plutus-core-1.0.0.1-6wMiyL0yerXJu56t8zBoKx" 'False) (C1 ('MetaCons "Name" 'PrefixI 'True) (S1 ('MetaSel ('Just "nameString") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just "nameUnique") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Unique))) |
We use a newtype
to enforce separation between names used for types and
those used for terms.
Instances
Eq TyName Source # | |
Ord TyName Source # | |
Defined in PlutusCore.Name | |
Show TyName Source # | |
Generic TyName Source # | |
NFData TyName Source # | |
Defined in PlutusCore.Name | |
Hashable TyName Source # | |
Defined in PlutusCore.Name | |
Wrapped TyName Source # | |
ToScopedName TyName Source # | |
Defined in PlutusCore.Check.Scoping toScopedName :: TyName -> ScopedName Source # | |
Flat TyName | |
Lift TyName Source # | |
HasPrettyConfigName config => PrettyBy config TyName Source # | |
Defined in PlutusCore.Name | |
HasUnique TyName TypeUnique Source # | |
Defined in PlutusCore.Name | |
tyname ~ TyName => Reference TyName (Type tyname uni) Source # | |
Defined in PlutusCore.Core.Instance.Scoping referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> TyName -> Type tyname uni NameAnn -> Type tyname uni NameAnn Source # | |
tyname ~ TyName => Reference TyName (Term tyname name uni fun) Source # | |
Defined in PlutusCore.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> TyName -> Term tyname name uni fun NameAnn -> Term tyname name uni fun NameAnn Source # | |
tyname ~ TyName => Reference TyName (Term tyname name uni fun) Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> TyName -> Term tyname name uni fun NameAnn -> Term tyname name uni fun NameAnn Source # | |
tyname ~ TyName => Reference TyName (Binding tyname name uni fun) Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> TyName -> Binding tyname name uni fun NameAnn -> Binding tyname name uni fun NameAnn Source # | |
tyname ~ TyName => Reference TyName (Datatype tyname name uni fun) Source # | Scoping for data types is hard, so we employ some extra paranoia and reference the provided
|
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> TyName -> Datatype tyname name uni fun NameAnn -> Datatype tyname name uni fun NameAnn Source # | |
tyname ~ TyName => Reference TyName (VarDecl tyname name uni fun) Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> TyName -> VarDecl tyname name uni fun NameAnn -> VarDecl tyname name uni fun NameAnn Source # | |
Flat (Binder TyName) | |
(GEq uni, Eq ann) => Eq (Type TyName uni ann) Source # | |
TermLike (Term name uni fun) TyName name uni fun Source # | |
Defined in UntypedPlutusCore.Core.Type var :: ann -> name -> Term name uni fun ann Source # tyAbs :: ann -> TyName -> Kind ann -> Term name uni fun ann -> Term name uni fun ann Source # lamAbs :: ann -> name -> Type TyName uni ann -> Term name uni fun ann -> Term name uni fun ann Source # apply :: ann -> Term name uni fun ann -> Term name uni fun ann -> Term name uni fun ann Source # constant :: ann -> Some (ValueOf uni) -> Term name uni fun ann Source # builtin :: ann -> fun -> Term name uni fun ann Source # tyInst :: ann -> Term name uni fun ann -> Type TyName uni ann -> Term name uni fun ann Source # unwrap :: ann -> Term name uni fun ann -> Term name uni fun ann Source # iWrap :: ann -> Type TyName uni ann -> Type TyName uni ann -> Term name uni fun ann -> Term name uni fun ann Source # error :: ann -> Type TyName uni ann -> Term name uni fun ann Source # termLet :: ann -> TermDef (Term name uni fun) TyName name uni fun ann -> Term name uni fun ann -> Term name uni fun ann Source # typeLet :: ann -> TypeDef TyName uni ann -> Term name uni fun ann -> Term name uni fun ann Source # | |
AsTypeError (Error uni fun ann) (Term TyName Name uni fun ()) uni fun ann Source # | |
Defined in PlutusCore.Error _TypeError :: Prism' (Error uni fun ann) (TypeError (Term TyName Name uni fun ()) uni fun ann) Source # _KindMismatch :: Prism' (Error uni fun ann) (ann, Type TyName uni (), Kind (), Kind ()) Source # _TypeMismatch :: Prism' (Error uni fun ann) (ann, Term TyName Name uni fun (), Type TyName uni (), Normalized (Type TyName uni ())) Source # _FreeTypeVariableE :: Prism' (Error uni fun ann) (ann, TyName) Source # _FreeVariableE :: Prism' (Error uni fun ann) (ann, Name) Source # _UnknownBuiltinFunctionE :: Prism' (Error uni fun ann) (ann, fun) Source # | |
AsTypeError (Error uni fun a) (Term TyName Name uni fun ()) uni fun a Source # | |
Defined in PlutusIR.Error _TypeError :: Prism' (Error uni fun a) (TypeError (Term TyName Name uni fun ()) uni fun a) Source # _KindMismatch :: Prism' (Error uni fun a) (a, Type TyName uni (), Kind (), Kind ()) Source # _TypeMismatch :: Prism' (Error uni fun a) (a, Term TyName Name uni fun (), Type TyName uni (), Normalized (Type TyName uni ())) Source # _FreeTypeVariableE :: Prism' (Error uni fun a) (a, TyName) Source # _FreeVariableE :: Prism' (Error uni fun a) (a, Name) Source # _UnknownBuiltinFunctionE :: Prism' (Error uni fun a) (a, fun) Source # | |
(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term TyName Name uni fun ann) Source # | |
HasConstant (Term TyName Name uni fun ()) Source # | |
Defined in PlutusCore.Builtin.HasConstant | |
(Reference TyName t, Reference Name t) => Reference (Binding TyName Name uni fun ann) t Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> Binding TyName Name uni fun ann -> t NameAnn -> t NameAnn Source # | |
(Reference TyName t, Reference Name t) => Reference (Datatype TyName Name uni fun ann) t Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> Datatype TyName Name uni fun ann -> t NameAnn -> t NameAnn Source # | |
type Rep TyName Source # | |
Defined in PlutusCore.Name | |
type Unwrapped TyName Source # | |
Defined in PlutusCore.Name |
A unique identifier
Instances
Enum Unique Source # | |
Defined in PlutusCore.Name succ :: Unique -> Unique Source # pred :: Unique -> Unique Source # toEnum :: Int -> Unique Source # fromEnum :: Unique -> Int Source # enumFrom :: Unique -> [Unique] Source # enumFromThen :: Unique -> Unique -> [Unique] Source # enumFromTo :: Unique -> Unique -> [Unique] Source # enumFromThenTo :: Unique -> Unique -> Unique -> [Unique] Source # | |
Eq Unique Source # | |
Ord Unique Source # | |
Defined in PlutusCore.Name | |
Show Unique Source # | |
NFData Unique Source # | |
Defined in PlutusCore.Name | |
Hashable Unique Source # | |
Defined in PlutusCore.Name | |
Pretty Unique Source # | |
Defined in PlutusCore.Name | |
ExMemoryUsage Unique Source # | |
Defined in PlutusCore.Evaluation.Machine.ExMemory memoryUsage :: Unique -> ExMemory Source # | |
Flat Unique | |
Lift Unique Source # | |
HasUnique Unique Unique Source # | |
newtype TypeUnique Source #
The unique of a type-level name.
Instances
Eq TypeUnique Source # | |
Defined in PlutusCore.Name (==) :: TypeUnique -> TypeUnique -> Bool Source # (/=) :: TypeUnique -> TypeUnique -> Bool Source # | |
Ord TypeUnique Source # | |
Defined in PlutusCore.Name compare :: TypeUnique -> TypeUnique -> Ordering Source # (<) :: TypeUnique -> TypeUnique -> Bool Source # (<=) :: TypeUnique -> TypeUnique -> Bool Source # (>) :: TypeUnique -> TypeUnique -> Bool Source # (>=) :: TypeUnique -> TypeUnique -> Bool Source # max :: TypeUnique -> TypeUnique -> TypeUnique Source # min :: TypeUnique -> TypeUnique -> TypeUnique Source # | |
Hashable TypeUnique Source # | |
Defined in PlutusCore.Name hashWithSalt :: Int -> TypeUnique -> Int hash :: TypeUnique -> Int | |
HasUnique TyName TypeUnique Source # | |
Defined in PlutusCore.Name | |
HasRenaming ScopedRenaming TypeUnique Source # | |
Defined in PlutusCore.Rename.Monad | |
HasUnique tyname TypeUnique => HasUnique (TyVarDecl tyname ann) TypeUnique Source # | |
Defined in PlutusCore.Core.Type |
newtype TermUnique Source #
The unique of a term-level name.
Instances
Eq TermUnique Source # | |
Defined in PlutusCore.Name (==) :: TermUnique -> TermUnique -> Bool Source # (/=) :: TermUnique -> TermUnique -> Bool Source # | |
Ord TermUnique Source # | |
Defined in PlutusCore.Name compare :: TermUnique -> TermUnique -> Ordering Source # (<) :: TermUnique -> TermUnique -> Bool Source # (<=) :: TermUnique -> TermUnique -> Bool Source # (>) :: TermUnique -> TermUnique -> Bool Source # (>=) :: TermUnique -> TermUnique -> Bool Source # max :: TermUnique -> TermUnique -> TermUnique Source # min :: TermUnique -> TermUnique -> TermUnique Source # | |
Hashable TermUnique Source # | |
Defined in PlutusCore.Name hashWithSalt :: Int -> TermUnique -> Int hash :: TermUnique -> Int | |
HasUnique Name TermUnique Source # | |
Defined in PlutusCore.Name | |
HasRenaming ScopedRenaming TermUnique Source # | |
Defined in PlutusCore.Rename.Monad | |
HasUnique name TermUnique => HasUnique (VarDecl tyname name uni fun ann) TermUnique Source # | |
Defined in PlutusCore.Core.Type |
class Coercible unique Unique => HasUnique a unique | a -> unique where Source #
Types which have a Unique
attached to them, mostly names.
Nothing
Instances
HasUnique Unique Unique Source # | |
HasUnique TyName TypeUnique Source # | |
Defined in PlutusCore.Name | |
HasUnique Name TermUnique Source # | |
Defined in PlutusCore.Name | |
HasUnique tyname TypeUnique => HasUnique (TyVarDecl tyname ann) TypeUnique Source # | |
Defined in PlutusCore.Core.Type | |
HasUnique name TermUnique => HasUnique (VarDecl tyname name uni fun ann) TermUnique Source # | |
Defined in PlutusCore.Core.Type |
theUnique :: HasUnique name unique => Lens' name Unique Source #
A lens focused on the Unique
of a name.
newtype UniqueMap unique a Source #
A mapping from uniques to values of type a
.
UniqueMap | |
|
Functions
insertByUnique :: Coercible unique Unique => unique -> a -> UniqueMap unique a -> UniqueMap unique a Source #
Insert a value by a unique.
insertByName :: HasUnique name unique => name -> a -> UniqueMap unique a -> UniqueMap unique a Source #
Insert a value by the unique of a 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 #
fromUniques :: Foldable f => Coercible Unique unique => f (unique, 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.
mapNameString :: (Text -> Text) -> Name -> Name Source #
Apply a function to the string representation of a Name
.