plutus-core-1.0.0.1: Language library for Plutus Core
Safe HaskellNone
LanguageHaskell2010

PlutusCore.Name

Synopsis

Types

data Name Source #

A Name represents variables/names in Plutus Core.

Constructors

Name 

Fields

  • nameString :: Text

    The identifier name, for use in error messages.

  • nameUnique :: Unique

    A Unique assigned to the name, allowing for cheap comparisons in the compiler.

Instances

Instances details
Eq Name Source # 
Instance details

Defined in PlutusCore.Name

Methods

(==) :: Name -> Name -> Bool Source #

(/=) :: Name -> Name -> Bool Source #

Ord Name Source # 
Instance details

Defined in PlutusCore.Name

Show Name Source # 
Instance details

Defined in PlutusCore.Name

Generic Name Source # 
Instance details

Defined in PlutusCore.Name

Associated Types

type Rep Name :: Type -> Type Source #

Methods

from :: Name -> Rep Name x Source #

to :: Rep Name x -> Name Source #

NFData Name Source # 
Instance details

Defined in PlutusCore.Name

Methods

rnf :: Name -> () Source #

Hashable Name Source # 
Instance details

Defined in PlutusCore.Name

Methods

hashWithSalt :: Int -> Name -> Int

hash :: Name -> Int

ToScopedName Name Source # 
Instance details

Defined in PlutusCore.Check.Scoping

Flat Name 
Instance details

Defined in PlutusCore.Flat

Methods

encode :: Name -> Encoding

decode :: Get Name

size :: Name -> NumBits -> NumBits

Lift Name Source # 
Instance details

Defined in PlutusCore.Name

Methods

lift :: Name -> Q Exp Source #

liftTyped :: Name -> Q (TExp Name) Source #

HasPrettyConfigName config => PrettyBy config Name Source # 
Instance details

Defined in PlutusCore.Name

Methods

prettyBy :: config -> Name -> Doc ann #

prettyListBy :: config -> [Name] -> Doc ann #

HasUnique Name TermUnique Source # 
Instance details

Defined in PlutusCore.Name

name ~ Name => Reference Name (Term tyname name uni fun) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Scoping

Methods

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 # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

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 Reference instances this one does not guarantee that the name will actually be referenced, but it's too convenient to have this instance to give up on it, without it would be awkward to express "reference this binding in this thing".

Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> Name -> Binding tyname name uni fun NameAnn -> Binding tyname name uni fun NameAnn Source #

Flat (Binder Name) 
Instance details

Defined in PlutusCore.Flat

Methods

encode :: Binder Name -> Encoding

decode :: Get (Binder Name)

size :: Binder Name -> NumBits -> NumBits

AsTypeError (Error uni fun ann) (Term TyName Name uni fun ()) uni fun ann Source # 
Instance details

Defined in PlutusCore.Error

Methods

_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 # 
Instance details

Defined in PlutusIR.Error

Methods

_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 # 
Instance details

Defined in UntypedPlutusCore.Core.Instance.Eq

Methods

(==) :: Term Name uni fun ann -> Term Name uni fun ann -> Bool Source #

(/=) :: Term Name uni fun ann -> Term Name uni fun ann -> Bool Source #

(GEq uni, Closed uni, Everywhere uni Eq, Eq fun, Eq ann) => Eq (Term TyName Name uni fun ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Eq

Methods

(==) :: Term TyName Name uni fun ann -> Term TyName Name uni fun ann -> Bool Source #

(/=) :: Term TyName Name uni fun ann -> Term TyName Name uni fun ann -> Bool Source #

HasConstant (Term TyName Name uni fun ()) Source # 
Instance details

Defined in PlutusCore.Builtin.HasConstant

Methods

asConstant :: AsUnliftingError err => Maybe cause -> Term TyName Name uni fun () -> Either (ErrorWithCause err cause) (Some (ValueOf (UniOf (Term TyName Name uni fun ())))) Source #

fromConstant :: Some (ValueOf (UniOf (Term TyName Name uni fun ()))) -> Term TyName Name uni fun () Source #

(Reference TyName t, Reference Name t) => Reference (Binding TyName Name uni fun ann) t Source # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

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 # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> Datatype TyName Name uni fun ann -> t NameAnn -> t NameAnn Source #

type Rep Name Source # 
Instance details

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)))

newtype TyName Source #

We use a newtype to enforce separation between names used for types and those used for terms.

Constructors

TyName 

Fields

Instances

Instances details
Eq TyName Source # 
Instance details

Defined in PlutusCore.Name

Ord TyName Source # 
Instance details

Defined in PlutusCore.Name

Show TyName Source # 
Instance details

Defined in PlutusCore.Name

Generic TyName Source # 
Instance details

Defined in PlutusCore.Name

Associated Types

type Rep TyName :: Type -> Type Source #

NFData TyName Source # 
Instance details

Defined in PlutusCore.Name

Methods

rnf :: TyName -> () Source #

Hashable TyName Source # 
Instance details

Defined in PlutusCore.Name

Methods

hashWithSalt :: Int -> TyName -> Int

hash :: TyName -> Int

Wrapped TyName Source # 
Instance details

Defined in PlutusCore.Name

Associated Types

type Unwrapped TyName

Methods

_Wrapped' :: Iso' TyName (Unwrapped TyName)

ToScopedName TyName Source # 
Instance details

Defined in PlutusCore.Check.Scoping

Flat TyName 
Instance details

Defined in PlutusCore.Flat

Methods

encode :: TyName -> Encoding

decode :: Get TyName

size :: TyName -> NumBits -> NumBits

Lift TyName Source # 
Instance details

Defined in PlutusCore.Name

HasPrettyConfigName config => PrettyBy config TyName Source # 
Instance details

Defined in PlutusCore.Name

Methods

prettyBy :: config -> TyName -> Doc ann #

prettyListBy :: config -> [TyName] -> Doc ann #

HasUnique TyName TypeUnique Source # 
Instance details

Defined in PlutusCore.Name

tyname ~ TyName => Reference TyName (Type tyname uni) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Scoping

Methods

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 # 
Instance details

Defined in PlutusCore.Core.Instance.Scoping

Methods

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 # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

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 # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

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 TyName in the type of every single constructor, and also apply the final head to that TyName.

Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

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 # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

referenceVia :: (forall name0. ToScopedName name0 => name0 -> NameAnn) -> TyName -> VarDecl tyname name uni fun NameAnn -> VarDecl tyname name uni fun NameAnn Source #

Flat (Binder TyName) 
Instance details

Defined in PlutusCore.Flat

Methods

encode :: Binder TyName -> Encoding

decode :: Get (Binder TyName)

size :: Binder TyName -> NumBits -> NumBits

(GEq uni, Eq ann) => Eq (Type TyName uni ann) Source # 
Instance details

Defined in PlutusCore.Core.Instance.Eq

Methods

(==) :: Type TyName uni ann -> Type TyName uni ann -> Bool Source #

(/=) :: Type TyName uni ann -> Type TyName uni ann -> Bool Source #

TermLike (Term name uni fun) TyName name uni fun Source # 
Instance details

Defined in UntypedPlutusCore.Core.Type

Methods

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 # 
Instance details

Defined in PlutusCore.Error

Methods

_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 # 
Instance details

Defined in PlutusIR.Error

Methods

_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 # 
Instance details

Defined in PlutusCore.Core.Instance.Eq

Methods

(==) :: Term TyName Name uni fun ann -> Term TyName Name uni fun ann -> Bool Source #

(/=) :: Term TyName Name uni fun ann -> Term TyName Name uni fun ann -> Bool Source #

HasConstant (Term TyName Name uni fun ()) Source # 
Instance details

Defined in PlutusCore.Builtin.HasConstant

Methods

asConstant :: AsUnliftingError err => Maybe cause -> Term TyName Name uni fun () -> Either (ErrorWithCause err cause) (Some (ValueOf (UniOf (Term TyName Name uni fun ())))) Source #

fromConstant :: Some (ValueOf (UniOf (Term TyName Name uni fun ()))) -> Term TyName Name uni fun () Source #

(Reference TyName t, Reference Name t) => Reference (Binding TyName Name uni fun ann) t Source # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

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 # 
Instance details

Defined in PlutusIR.Core.Instance.Scoping

Methods

referenceVia :: (forall name. ToScopedName name => name -> NameAnn) -> Datatype TyName Name uni fun ann -> t NameAnn -> t NameAnn Source #

type Rep TyName Source # 
Instance details

Defined in PlutusCore.Name

type Rep TyName = D1 ('MetaData "TyName" "PlutusCore.Name" "plutus-core-1.0.0.1-6wMiyL0yerXJu56t8zBoKx" 'True) (C1 ('MetaCons "TyName" 'PrefixI 'True) (S1 ('MetaSel ('Just "unTyName") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Name)))
type Unwrapped TyName Source # 
Instance details

Defined in PlutusCore.Name

type Unwrapped TyName = GUnwrapped (Rep TyName)

newtype Unique Source #

A unique identifier

Constructors

Unique 

Fields

Instances

Instances details
Enum Unique Source # 
Instance details

Defined in PlutusCore.Name

Eq Unique Source # 
Instance details

Defined in PlutusCore.Name

Ord Unique Source # 
Instance details

Defined in PlutusCore.Name

Show Unique Source # 
Instance details

Defined in PlutusCore.Name

NFData Unique Source # 
Instance details

Defined in PlutusCore.Name

Methods

rnf :: Unique -> () Source #

Hashable Unique Source # 
Instance details

Defined in PlutusCore.Name

Methods

hashWithSalt :: Int -> Unique -> Int

hash :: Unique -> Int

Pretty Unique Source # 
Instance details

Defined in PlutusCore.Name

Methods

pretty :: Unique -> Doc ann #

prettyList :: [Unique] -> Doc ann #

ExMemoryUsage Unique Source # 
Instance details

Defined in PlutusCore.Evaluation.Machine.ExMemory

Flat Unique 
Instance details

Defined in PlutusCore.Flat

Methods

encode :: Unique -> Encoding

decode :: Get Unique

size :: Unique -> NumBits -> NumBits

Lift Unique Source # 
Instance details

Defined in PlutusCore.Name

HasUnique Unique Unique Source # 
Instance details

Defined in PlutusCore.Name

newtype TermUnique Source #

The unique of a term-level name.

Constructors

TermUnique 

Fields

class Coercible unique Unique => HasUnique a unique | a -> unique where Source #

Types which have a Unique attached to them, mostly names.

Minimal complete definition

Nothing

Methods

unique :: Lens' a unique Source #

The default implementation of HasUnique for newtypes.

default unique :: (Wrapped a, HasUnique (Unwrapped a) unique', Coercible unique' unique) => Lens' a unique Source #

Instances

Instances details
HasUnique Unique Unique Source # 
Instance details

Defined in PlutusCore.Name

HasUnique TyName TypeUnique Source # 
Instance details

Defined in PlutusCore.Name

HasUnique Name TermUnique Source # 
Instance details

Defined in PlutusCore.Name

HasUnique tyname TypeUnique => HasUnique (TyVarDecl tyname ann) TypeUnique Source # 
Instance details

Defined in PlutusCore.Core.Type

Methods

unique :: Lens' (TyVarDecl tyname ann) TypeUnique Source #

HasUnique name TermUnique => HasUnique (VarDecl tyname name uni fun ann) TermUnique Source # 
Instance details

Defined in PlutusCore.Core.Type

Methods

unique :: Lens' (VarDecl tyname name uni fun ann) TermUnique Source #

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.

Constructors

UniqueMap 

Fields

Instances

Instances details
Functor (UniqueMap unique) Source # 
Instance details

Defined in PlutusCore.Name

Methods

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

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

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

Defined in PlutusCore.Name

Methods

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

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

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

Defined in PlutusCore.Name

Methods

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

show :: UniqueMap unique a -> String Source #

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

Semigroup (UniqueMap unique a) Source # 
Instance details

Defined in PlutusCore.Name

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 #

Monoid (UniqueMap unique a) Source # 
Instance details

Defined in PlutusCore.Name

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 #

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 #

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.

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.

mapTyNameString :: (Text -> Text) -> TyName -> TyName Source #

Apply a function to the string representation of a TyName.

isEmpty :: UniqueMap unique a -> Bool Source #