Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
-
class
TermLike
term tyname name uni fun | term -> tyname name uni fun
where
- var :: ann -> name -> term ann
- tyAbs :: ann -> tyname -> Kind ann -> term ann -> term ann
- lamAbs :: ann -> name -> Type tyname uni ann -> term ann -> term ann
- apply :: ann -> term ann -> term ann -> term ann
- constant :: ann -> Some ( ValueOf uni) -> term ann
- builtin :: ann -> fun -> term ann
- tyInst :: ann -> term ann -> Type tyname uni ann -> term ann
- unwrap :: ann -> term ann -> term ann
- iWrap :: ann -> Type tyname uni ann -> Type tyname uni ann -> term ann -> term ann
- error :: ann -> Type tyname uni ann -> term ann
- termLet :: ann -> TermDef term tyname name uni fun ann -> term ann -> term ann
- typeLet :: ann -> TypeDef tyname uni ann -> term ann -> term ann
- type family UniOf a :: Type -> Type
- mkTyBuiltinOf :: forall k (a :: k) uni tyname ann. ann -> uni ( Esc a) -> Type tyname uni ann
- mkTyBuiltin :: forall k (a :: k) uni tyname ann. uni `Contains` a => ann -> Type tyname uni ann
- mkConstantOf :: forall a uni fun term tyname name ann. TermLike term tyname name uni fun => ann -> uni ( Esc a) -> a -> term ann
- mkConstant :: forall a uni fun term tyname name ann. ( TermLike term tyname name uni fun, uni `Includes` a) => ann -> a -> term ann
-
data
VarDecl
tyname name uni fun ann =
VarDecl
{
- _varDeclAnn :: ann
- _varDeclName :: name
- _varDeclType :: Type tyname uni ann
-
data
TyVarDecl
tyname ann =
TyVarDecl
{
- _tyVarDeclAnn :: ann
- _tyVarDeclName :: tyname
- _tyVarDeclKind :: Kind ann
-
data
TyDecl
tyname uni ann =
TyDecl
{
- _tyDeclAnn :: ann
- _tyDeclType :: Type tyname uni ann
- _tyDeclKind :: Kind ann
- mkVar :: TermLike term tyname name uni fun => ann -> VarDecl tyname name uni fun ann -> term ann
- mkTyVar :: ann -> TyVarDecl tyname ann -> Type tyname uni ann
- tyDeclVar :: TyVarDecl tyname ann -> TyDecl tyname uni ann
- data Def var val = Def { }
- embed :: TermLike term tyname name uni fun => Term tyname name uni fun ann -> term ann
- type TermDef term tyname name uni fun ann = Def ( VarDecl tyname name uni fun ann) (term ann)
- type TypeDef tyname uni ann = Def ( TyVarDecl tyname ann) ( Type tyname uni ann)
-
data
FunctionType
tyname uni ann =
FunctionType
{
- _functionTypeAnn :: ann
- _functionTypeDom :: Type tyname uni ann
- _functionTypeCod :: Type tyname uni ann
-
data
FunctionDef
term tyname name uni fun ann =
FunctionDef
{
- _functionDefAnn :: ann
- _functionDefName :: name
- _functionDefType :: FunctionType tyname uni ann
- _functionDefTerm :: term ann
- functionTypeToType :: FunctionType tyname uni ann -> Type tyname uni ann
- functionDefToType :: FunctionDef term tyname name uni fun ann -> Type tyname uni ann
- functionDefVarDecl :: FunctionDef term tyname name uni fun ann -> VarDecl tyname name uni fun ann
- mkFunctionDef :: ann -> name -> Type tyname uni ann -> term ann -> Maybe ( FunctionDef term tyname name uni fun ann)
- mkImmediateLamAbs :: TermLike term tyname name uni fun => ann -> TermDef term tyname name uni fun ann -> term ann -> term ann
- mkImmediateTyAbs :: TermLike term tyname name uni fun => ann -> TypeDef tyname uni ann -> term ann -> term ann
- mkIterTyForall :: [ TyVarDecl tyname ann] -> Type tyname uni ann -> Type tyname uni ann
- mkIterTyLam :: [ TyVarDecl tyname ann] -> Type tyname uni ann -> Type tyname uni ann
- mkIterApp :: TermLike term tyname name uni fun => ann -> term ann -> [term ann] -> term ann
- mkIterTyFun :: ann -> [ Type tyname uni ann] -> Type tyname uni ann -> Type tyname uni ann
- mkIterLamAbs :: TermLike term tyname name uni fun => [ VarDecl tyname name uni fun ann] -> term ann -> term ann
- mkIterInst :: TermLike term tyname name uni fun => ann -> term ann -> [ Type tyname uni ann] -> term ann
- mkIterTyAbs :: TermLike term tyname name uni fun => [ TyVarDecl tyname ann] -> term ann -> term ann
- mkIterTyApp :: ann -> Type tyname uni ann -> [ Type tyname uni ann] -> Type tyname uni ann
- mkIterKindArrow :: ann -> [ Kind ann] -> Kind ann -> Kind ann
Documentation
class TermLike term tyname name uni fun | term -> tyname name uni fun where Source #
A final encoding for Term, to allow PLC terms to be used transparently as PIR terms.
var :: ann -> name -> term ann Source #
tyAbs :: ann -> tyname -> Kind ann -> term ann -> term ann Source #
lamAbs :: ann -> name -> Type tyname uni ann -> term ann -> term ann Source #
apply :: ann -> term ann -> term ann -> term ann Source #
constant :: ann -> Some ( ValueOf uni) -> term ann Source #
builtin :: ann -> fun -> term ann Source #
tyInst :: ann -> term ann -> Type tyname uni ann -> term ann Source #
unwrap :: ann -> term ann -> term ann Source #
iWrap :: ann -> Type tyname uni ann -> Type tyname uni ann -> term ann -> term ann Source #
error :: ann -> Type tyname uni ann -> term ann Source #
termLet :: ann -> TermDef term tyname name uni fun ann -> term ann -> term ann Source #
typeLet :: ann -> TypeDef tyname uni ann -> term ann -> term ann Source #
Instances
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 # |
|
TermLike ( Term tyname name uni fun) tyname name uni fun Source # | |
Defined in PlutusCore.MkPlc var :: ann -> name -> Term tyname name uni fun ann Source # tyAbs :: ann -> tyname -> Kind ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # lamAbs :: ann -> name -> Type tyname uni ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # apply :: ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # constant :: ann -> Some ( ValueOf uni) -> Term tyname name uni fun ann Source # builtin :: ann -> fun -> Term tyname name uni fun ann Source # tyInst :: ann -> Term tyname name uni fun ann -> Type tyname uni ann -> Term tyname name uni fun ann Source # unwrap :: ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # iWrap :: ann -> Type tyname uni ann -> Type tyname uni ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # error :: ann -> Type tyname uni ann -> Term tyname name uni fun ann Source # termLet :: ann -> TermDef ( Term tyname name uni fun) tyname name uni fun ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # typeLet :: ann -> TypeDef tyname uni ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # |
|
TermLike ( Term tyname name uni fun) tyname name uni fun Source # | |
Defined in PlutusIR.Core.Type var :: ann -> name -> Term tyname name uni fun ann Source # tyAbs :: ann -> tyname -> Kind ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # lamAbs :: ann -> name -> Type tyname uni ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # apply :: ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # constant :: ann -> Some ( ValueOf uni) -> Term tyname name uni fun ann Source # builtin :: ann -> fun -> Term tyname name uni fun ann Source # tyInst :: ann -> Term tyname name uni fun ann -> Type tyname uni ann -> Term tyname name uni fun ann Source # unwrap :: ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # iWrap :: ann -> Type tyname uni ann -> Type tyname uni ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # error :: ann -> Type tyname uni ann -> Term tyname name uni fun ann Source # termLet :: ann -> TermDef ( Term tyname name uni fun) tyname name uni fun ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # typeLet :: ann -> TypeDef tyname uni ann -> Term tyname name uni fun ann -> Term tyname name uni fun ann Source # |
type family UniOf a :: Type -> Type Source #
Extract the universe from a type.
Instances
type UniOf ( Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism |
|
type UniOf ( CkValue uni fun) Source # | |
Defined in PlutusCore.Evaluation.Machine.Ck |
|
type UniOf ( CekValue uni fun) Source # | |
type UniOf ( Term name uni fun ann) Source # | |
Defined in UntypedPlutusCore.Core.Type |
|
type UniOf ( Term tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type |
|
type UniOf ( Term tyname name uni fun ann) Source # | |
Defined in PlutusIR.Core.Type |
mkTyBuiltinOf :: forall k (a :: k) uni tyname ann. ann -> uni ( Esc a) -> Type tyname uni ann Source #
Embed a type (given its explicit type tag) into a PLC type.
mkTyBuiltin :: forall k (a :: k) uni tyname ann. uni `Contains` a => ann -> Type tyname uni ann Source #
Embed a type (provided it's in the universe) into a PLC type.
mkConstantOf :: forall a uni fun term tyname name ann. TermLike term tyname name uni fun => ann -> uni ( Esc a) -> a -> term ann Source #
Embed a Haskell value (given its explicit type tag) into a PLC term.
mkConstant :: forall a uni fun term tyname name ann. ( TermLike term tyname name uni fun, uni `Includes` a) => ann -> a -> term ann Source #
Embed a Haskell value (provided its type is in the universe) into a PLC term.
data VarDecl tyname name uni fun ann Source #
A "variable declaration", i.e. a name and a type for a variable.
VarDecl | |
|
Instances
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 # |
|
( PrettyClassicBy configName tyname, PrettyClassicBy configName name, GShow uni, Everywhere uni PrettyConst , Pretty ann) => PrettyBy ( PrettyConfigClassic configName) ( VarDecl tyname name uni fun ann) Source # | |
Defined in PlutusIR.Core.Instance.Pretty prettyBy :: PrettyConfigClassic configName -> VarDecl tyname name uni fun ann -> Doc ann0 Source # prettyListBy :: PrettyConfigClassic configName -> [ VarDecl tyname name uni fun ann] -> Doc ann0 Source # |
|
Functor ( VarDecl tyname name uni fun) Source # | |
(tyname ~ TyName , name ~ Name ) => CollectScopeInfo ( VarDecl tyname name uni fun) Source # | |
Defined in PlutusIR.Core.Instance.Scoping collectScopeInfo :: VarDecl tyname name uni fun NameAnn -> ScopeErrorOrInfo Source # |
|
( Show ann, Show name, Show tyname, GShow uni) => Show ( VarDecl tyname name uni fun ann) Source # | |
Generic ( VarDecl tyname name uni fun ann) Source # | |
( Closed uni, Flat fun, Flat ann, Flat tyname, Flat name) => Flat ( VarDecl tyname name uni fun ann) Source # | |
( PrettyClassic tyname, PrettyClassic name, GShow uni, Everywhere uni PrettyConst , Pretty ann) => Pretty ( VarDecl tyname name uni fun ann) Source # | |
HasUnique name TermUnique => HasUnique ( VarDecl tyname name uni fun ann) TermUnique Source # | |
Defined in PlutusCore.Core.Type |
|
Reference name t => Reference ( VarDecl tyname name uni fun ann) t Source # | |
Defined in PlutusIR.Core.Instance.Scoping referenceVia :: ( forall name0. ToScopedName name0 => name0 -> NameAnn ) -> VarDecl tyname name uni fun ann -> t NameAnn -> t NameAnn Source # |
|
type Rep ( VarDecl tyname name uni fun ann) Source # | |
Defined in PlutusCore.Core.Type
type
Rep
(
VarDecl
tyname name uni fun ann) =
D1
('
MetaData
"VarDecl" "PlutusCore.Core.Type" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" '
False
) (
C1
('
MetaCons
"VarDecl" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"_varDeclAnn") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
ann)
:*:
(
S1
('
MetaSel
('
Just
"_varDeclName") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
name)
:*:
S1
('
MetaSel
('
Just
"_varDeclType") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Type
tyname uni ann)))))
|
data TyVarDecl tyname ann Source #
A "type variable declaration", i.e. a name and a kind for a type variable.
TyVarDecl | |
|
Instances
data TyDecl tyname uni ann Source #
A "type declaration", i.e. a kind for a type.
TyDecl | |
|
Instances
Functor ( TyDecl tyname uni) Source # | |
( Show ann, Show tyname, GShow uni) => Show ( TyDecl tyname uni ann) Source # | |
Generic ( TyDecl tyname uni ann) Source # | |
type Rep ( TyDecl tyname uni ann) Source # | |
Defined in PlutusCore.Core.Type
type
Rep
(
TyDecl
tyname uni ann) =
D1
('
MetaData
"TyDecl" "PlutusCore.Core.Type" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" '
False
) (
C1
('
MetaCons
"TyDecl" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"_tyDeclAnn") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
ann)
:*:
(
S1
('
MetaSel
('
Just
"_tyDeclType") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Type
tyname uni ann))
:*:
S1
('
MetaSel
('
Just
"_tyDeclKind") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
(
Kind
ann)))))
|
mkVar :: TermLike term tyname name uni fun => ann -> VarDecl tyname name uni fun ann -> term ann Source #
A definition. Pretty much just a pair with more descriptive names.
Instances
( Eq var, Eq val) => Eq ( Def var val) Source # | |
( Ord var, Ord val) => Ord ( Def var val) Source # | |
Defined in PlutusCore.MkPlc compare :: Def var val -> Def var val -> Ordering Source # (<) :: Def var val -> Def var val -> Bool Source # (<=) :: Def var val -> Def var val -> Bool Source # (>) :: Def var val -> Def var val -> Bool Source # (>=) :: Def var val -> Def var val -> Bool Source # |
|
( Show var, Show val) => Show ( Def var val) Source # | |
Generic ( Def var val) Source # | |
type Rep ( Def var val) Source # | |
Defined in PlutusCore.MkPlc
type
Rep
(
Def
var val) =
D1
('
MetaData
"Def" "PlutusCore.MkPlc" "plutus-core-1.0.0.1-76bWF9ZEWyb4eDyjHx0kCS" '
False
) (
C1
('
MetaCons
"Def" '
PrefixI
'
True
) (
S1
('
MetaSel
('
Just
"defVar") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
var)
:*:
S1
('
MetaSel
('
Just
"defVal") '
NoSourceUnpackedness
'
NoSourceStrictness
'
DecidedLazy
) (
Rec0
val)))
|
type TermDef term tyname name uni fun ann = Def ( VarDecl tyname name uni fun ann) (term ann) Source #
A term definition as a variable.
type TypeDef tyname uni ann = Def ( TyVarDecl tyname ann) ( Type tyname uni ann) Source #
A type definition as a type variable.
data FunctionType tyname uni ann Source #
The type of a PLC function.
FunctionType | |
|
data FunctionDef term tyname name uni fun ann Source #
A PLC function.
FunctionDef | |
|
functionTypeToType :: FunctionType tyname uni ann -> Type tyname uni ann Source #
Convert a
FunctionType
to the corresponding
Type
.
functionDefToType :: FunctionDef term tyname name uni fun ann -> Type tyname uni ann Source #
Get the type of a
FunctionDef
.
functionDefVarDecl :: FunctionDef term tyname name uni fun ann -> VarDecl tyname name uni fun ann Source #
Convert a
FunctionDef
to a
VarDecl
. I.e. ignore the actual term.
mkFunctionDef :: ann -> name -> Type tyname uni ann -> term ann -> Maybe ( FunctionDef term tyname name uni fun ann) Source #
Make a
FunctionDef
. Return
Nothing
if the provided type is not functional.
:: TermLike term tyname name uni fun | |
=> ann | |
-> TermDef term tyname name uni fun ann | |
-> term ann |
The body of the let, possibly referencing the name. |
-> term ann |
Make a "let-binding" for a term as an immediately applied lambda abstraction.
:: TermLike term tyname name uni fun | |
=> ann | |
-> TypeDef tyname uni ann | |
-> term ann |
The body of the let, possibly referencing the name. |
-> term ann |
Make a "let-binding" for a type as an immediately instantiated type abstraction. Note: the body must be a value.
mkIterTyForall :: [ TyVarDecl tyname ann] -> Type tyname uni ann -> Type tyname uni ann Source #
Universally quantify a list of names.
mkIterTyLam :: [ TyVarDecl tyname ann] -> Type tyname uni ann -> Type tyname uni ann Source #
Lambda abstract a list of names.
:: TermLike term tyname name uni fun | |
=> ann | |
-> term ann |
f |
-> [term ann] |
[ x0 ... xn ] |
-> term ann |
[f x0 ... xn ] |
Make an iterated application.
mkIterTyFun :: ann -> [ Type tyname uni ann] -> Type tyname uni ann -> Type tyname uni ann Source #
Make an iterated function type.
mkIterLamAbs :: TermLike term tyname name uni fun => [ VarDecl tyname name uni fun ann] -> term ann -> term ann Source #
Lambda abstract a list of names.
:: TermLike term tyname name uni fun | |
=> ann | |
-> term ann |
a |
-> [ Type tyname uni ann] |
[ x0 ... xn ] |
-> term ann |
{ a x0 ... xn } |
Make an iterated instantiation.
mkIterTyAbs :: TermLike term tyname name uni fun => [ TyVarDecl tyname ann] -> term ann -> term ann Source #
Type abstract a list of names.