Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- compileTerm :: Compiling m e uni fun a => Term TyName Name uni fun a -> m (PLCTerm uni fun a)
- compileToReadable :: ( Compiling m e uni fun a, b ~ Provenance a) => Term TyName Name uni fun a -> m ( Term TyName Name uni fun b)
- compileReadableToPlc :: ( Compiling m e uni fun a, b ~ Provenance a) => Term TyName Name uni fun b -> m (PLCTerm uni fun a)
- type Compiling m e uni fun a = ( Monad m, MonadReader ( CompilationCtx uni fun a) m, AsTypeError e ( Term TyName Name uni fun ()) uni fun ( Provenance a), AsTypeErrorExt e uni ( Provenance a), AsError e uni fun ( Provenance a), MonadError e m, MonadQuote m, Ord a, Typecheckable uni fun, GEq uni, Pretty fun, Closed uni, GShow uni, uni `Everywhere` PrettyConst , Pretty a)
-
data
Error
uni fun a
- = CompilationError a Text
- | UnsupportedError a Text
- | PLCError ( Error uni fun a)
- | PLCTypeError ( TypeError ( Term TyName Name uni fun ()) uni fun a)
- | PIRTypeError ( TypeErrorExt uni a)
-
class
AsError
r uni fun a | r -> uni fun a
where
- _Error :: Prism' r ( Error uni fun a)
- _CompilationError :: Prism' r (a, Text )
- _UnsupportedError :: Prism' r (a, Text )
- _PLCError :: Prism' r ( Error uni fun a)
- _PLCTypeError :: Prism' r ( TypeError ( Term TyName Name uni fun ()) uni fun a)
- _PIRTypeError :: Prism' r ( TypeErrorExt uni a)
-
class
AsTypeError
r term uni fun ann | r -> term uni fun ann
where
- _TypeError :: Prism' r ( TypeError term uni fun ann)
- _KindMismatch :: Prism' r (ann, Type TyName uni (), Kind (), Kind ())
- _TypeMismatch :: Prism' r (ann, term, Type TyName uni (), Normalized ( Type TyName uni ()))
- _FreeTypeVariableE :: Prism' r (ann, TyName )
- _FreeVariableE :: Prism' r (ann, Name )
- _UnknownBuiltinFunctionE :: Prism' r (ann, fun)
-
class
AsTypeErrorExt
r uni ann | r -> uni ann
where
- _TypeErrorExt :: Prism' r ( TypeErrorExt uni ann)
- _MalformedDataConstrResType :: Prism' r (ann, Type TyName uni ann)
-
data
Provenance
a
- = Original a
- | LetBinding Recursivity ( Provenance a)
- | TermBinding String ( Provenance a)
- | TypeBinding String ( Provenance a)
- | DatatypeComponent DatatypeComponent ( Provenance a)
- | MultipleSources ( Set ( Provenance a))
- data DatatypeComponent
- noProvenance :: Provenance a
- data CompilationOpts a
- coOptimize :: forall a. Lens' ( CompilationOpts a) Bool
- coPedantic :: forall a. Lens' ( CompilationOpts a) Bool
- coVerbose :: forall a. Lens' ( CompilationOpts a) Bool
- coDebug :: forall a. Lens' ( CompilationOpts a) Bool
- coMaxSimplifierIterations :: forall a. Lens' ( CompilationOpts a) Int
- coDoSimplifierUnwrapCancel :: forall a. Lens' ( CompilationOpts a) Bool
- coDoSimplifierBeta :: forall a. Lens' ( CompilationOpts a) Bool
- coDoSimplifierInline :: forall a. Lens' ( CompilationOpts a) Bool
- coInlineHints :: forall a a. Lens ( CompilationOpts a) ( CompilationOpts a) ( InlineHints Name ( Provenance a)) ( InlineHints Name ( Provenance a))
- coProfile :: forall a. Lens' ( CompilationOpts a) Bool
- defaultCompilationOpts :: CompilationOpts a
- data CompilationCtx uni fun a
- ccOpts :: forall uni fun a. Lens' ( CompilationCtx uni fun a) ( CompilationOpts a)
- ccEnclosing :: forall uni fun a. Lens' ( CompilationCtx uni fun a) ( Provenance a)
- ccTypeCheckConfig :: forall uni fun a uni fun. Lens ( CompilationCtx uni fun a) ( CompilationCtx uni fun a) ( Maybe ( PirTCConfig uni fun)) ( Maybe ( PirTCConfig uni fun))
-
data
PirTCConfig
uni fun =
PirTCConfig
{
- _pirConfigTCConfig :: TypeCheckConfig uni fun
- _pirConfigAllowEscape :: AllowEscape
- data AllowEscape
- toDefaultCompilationCtx :: TypeCheckConfig uni fun -> CompilationCtx uni fun a
Documentation
compileTerm :: Compiling m e uni fun a => Term TyName Name uni fun a -> m (PLCTerm uni fun a) Source #
compileToReadable :: ( Compiling m e uni fun a, b ~ Provenance a) => Term TyName Name uni fun a -> m ( Term TyName Name uni fun b) Source #
The 1st half of the PIR compiler pipeline up to floating/merging the lets. We stop momentarily here to give a chance to the tx-plugin to dump a "readable" version of pir (i.e. floated).
compileReadableToPlc :: ( Compiling m e uni fun a, b ~ Provenance a) => Term TyName Name uni fun b -> m (PLCTerm uni fun a) Source #
The 2nd half of the PIR compiler pipeline.
Compiles a
Term
into a PLC Term, by removing/translating step-by-step the PIR's language constructs to PLC.
Note: the result *does* have globally unique names.
type Compiling m e uni fun a = ( Monad m, MonadReader ( CompilationCtx uni fun a) m, AsTypeError e ( Term TyName Name uni fun ()) uni fun ( Provenance a), AsTypeErrorExt e uni ( Provenance a), AsError e uni fun ( Provenance a), MonadError e m, MonadQuote m, Ord a, Typecheckable uni fun, GEq uni, Pretty fun, Closed uni, GShow uni, uni `Everywhere` PrettyConst , Pretty a) Source #
CompilationError a Text |
A generic compilation error. |
UnsupportedError a Text |
An error relating specifically to an unsupported feature. |
PLCError ( Error uni fun a) |
An error from running some PLC function, lifted into this error type for convenience. |
PLCTypeError ( TypeError ( Term TyName Name uni fun ()) uni fun a) | |
PIRTypeError ( TypeErrorExt uni a) |
Instances
class AsError r uni fun a | r -> uni fun a where Source #
_Error :: Prism' r ( Error uni fun a) Source #
_CompilationError :: Prism' r (a, Text ) Source #
_UnsupportedError :: Prism' r (a, Text ) Source #
_PLCError :: Prism' r ( Error uni fun a) Source #
_PLCTypeError :: Prism' r ( TypeError ( Term TyName Name uni fun ()) uni fun a) Source #
_PIRTypeError :: Prism' r ( TypeErrorExt uni a) Source #
Instances
AsError ( Error uni fun a) uni fun a Source # | |
Defined in PlutusIR.Error _Error :: Prism' ( Error uni fun a) ( Error uni fun a) Source # _CompilationError :: Prism' ( Error uni fun a) (a, Text ) Source # _UnsupportedError :: Prism' ( Error uni fun a) (a, Text ) Source # _PLCError :: Prism' ( Error uni fun a) ( Error0 uni fun a) Source # _PLCTypeError :: Prism' ( Error uni fun a) ( TypeError ( Term TyName Name uni fun ()) uni fun a) Source # _PIRTypeError :: Prism' ( Error uni fun a) ( TypeErrorExt uni a) Source # |
class AsTypeError r term uni fun ann | r -> term uni fun ann where Source #
_TypeError :: Prism' r ( TypeError term uni fun ann) Source #
_KindMismatch :: Prism' r (ann, Type TyName uni (), Kind (), Kind ()) Source #
_TypeMismatch :: Prism' r (ann, term, Type TyName uni (), Normalized ( Type TyName uni ())) Source #
_FreeTypeVariableE :: Prism' r (ann, TyName ) Source #
_FreeVariableE :: Prism' r (ann, Name ) Source #
_UnknownBuiltinFunctionE :: Prism' r (ann, fun) Source #
Instances
class AsTypeErrorExt r uni ann | r -> uni ann where Source #
_TypeErrorExt :: Prism' r ( TypeErrorExt uni ann) Source #
_MalformedDataConstrResType :: Prism' r (ann, Type TyName uni ann) Source #
Instances
AsTypeErrorExt ( TypeErrorExt uni ann) uni ann Source # | |
Defined in PlutusIR.Error _TypeErrorExt :: Prism' ( TypeErrorExt uni ann) ( TypeErrorExt uni ann) Source # _MalformedDataConstrResType :: Prism' ( TypeErrorExt uni ann) (ann, Type TyName uni ann) Source # |
|
AsTypeErrorExt ( Error uni fun a) uni a Source # | |
Defined in PlutusIR.Error _TypeErrorExt :: Prism' ( Error uni fun a) ( TypeErrorExt uni a) Source # _MalformedDataConstrResType :: Prism' ( Error uni fun a) (a, Type TyName uni a) Source # |
data Provenance a Source #
Indicates where a value comes from.
This is either an original annotation or a pieces of context explaining how the term
relates to a previous
Provenance
. We also provide
NoProvenance
for convenience.
The provenance should always be just the original annotation, if we have one. It should only be another kind of provenance if we're in the process of generating some term that doesn't correspond directly to a term in the original AST.
Original a | |
LetBinding Recursivity ( Provenance a) | |
TermBinding String ( Provenance a) | |
TypeBinding String ( Provenance a) | |
DatatypeComponent DatatypeComponent ( Provenance a) | |
MultipleSources ( Set ( Provenance a)) |
Added for accumulating difference provenances when floating lets |
Instances
data DatatypeComponent Source #
Instances
Eq DatatypeComponent Source # | |
Defined in PlutusIR.Compiler.Provenance (==) :: DatatypeComponent -> DatatypeComponent -> Bool Source # (/=) :: DatatypeComponent -> DatatypeComponent -> Bool Source # |
|
Ord DatatypeComponent Source # | |
Defined in PlutusIR.Compiler.Provenance compare :: DatatypeComponent -> DatatypeComponent -> Ordering Source # (<) :: DatatypeComponent -> DatatypeComponent -> Bool Source # (<=) :: DatatypeComponent -> DatatypeComponent -> Bool Source # (>) :: DatatypeComponent -> DatatypeComponent -> Bool Source # (>=) :: DatatypeComponent -> DatatypeComponent -> Bool Source # max :: DatatypeComponent -> DatatypeComponent -> DatatypeComponent Source # min :: DatatypeComponent -> DatatypeComponent -> DatatypeComponent Source # |
|
Show DatatypeComponent Source # | |
Defined in PlutusIR.Compiler.Provenance |
|
Pretty DatatypeComponent Source # | |
Defined in PlutusIR.Compiler.Provenance pretty :: DatatypeComponent -> Doc ann Source # prettyList :: [ DatatypeComponent ] -> Doc ann Source # |
noProvenance :: Provenance a Source #
data CompilationOpts a Source #
Instances
Show ( CompilationOpts a) Source # | |
Defined in PlutusIR.Compiler.Types |
coOptimize :: forall a. Lens' ( CompilationOpts a) Bool Source #
coPedantic :: forall a. Lens' ( CompilationOpts a) Bool Source #
coMaxSimplifierIterations :: forall a. Lens' ( CompilationOpts a) Int Source #
coDoSimplifierUnwrapCancel :: forall a. Lens' ( CompilationOpts a) Bool Source #
coDoSimplifierBeta :: forall a. Lens' ( CompilationOpts a) Bool Source #
coDoSimplifierInline :: forall a. Lens' ( CompilationOpts a) Bool Source #
coInlineHints :: forall a a. Lens ( CompilationOpts a) ( CompilationOpts a) ( InlineHints Name ( Provenance a)) ( InlineHints Name ( Provenance a)) Source #
data CompilationCtx uni fun a Source #
ccOpts :: forall uni fun a. Lens' ( CompilationCtx uni fun a) ( CompilationOpts a) Source #
ccEnclosing :: forall uni fun a. Lens' ( CompilationCtx uni fun a) ( Provenance a) Source #
ccTypeCheckConfig :: forall uni fun a uni fun. Lens ( CompilationCtx uni fun a) ( CompilationCtx uni fun a) ( Maybe ( PirTCConfig uni fun)) ( Maybe ( PirTCConfig uni fun)) Source #
data PirTCConfig uni fun Source #
extending the plc typecheck config with AllowEscape
data AllowEscape Source #
Extra flag to be passed in the TypeCheckM Reader context, to signal if the PIR expression currently being typechecked is at the top-level and thus its type can escape, or nested and thus not allowed to escape.
toDefaultCompilationCtx :: TypeCheckConfig uni fun -> CompilationCtx uni fun a Source #