plutus-core-1.60.0.0: Language library for Plutus Core
Safe HaskellSafe-Inferred
LanguageHaskell2010

PlutusCore.Annotation

Synopsis

Documentation

data Ann #

An annotation type used during the compilation.

Instances

Instances details
Generic Ann # 
Instance details

Defined in PlutusCore.Annotation

Associated Types

type Rep Ann :: Type -> Type #

Methods

from :: Ann -> Rep Ann x #

to :: Rep Ann x -> Ann #

Show Ann # 
Instance details

Defined in PlutusCore.Annotation

Methods

showsPrec :: Int -> Ann -> ShowS #

show :: Ann -> String #

showList :: [Ann] -> ShowS #

Default Ann # 
Instance details

Defined in PlutusCore.Annotation

Methods

def :: Ann #

Eq Ann # 
Instance details

Defined in PlutusCore.Annotation

Methods

(==) :: Ann -> Ann -> Bool #

(/=) :: Ann -> Ann -> Bool #

Ord Ann # 
Instance details

Defined in PlutusCore.Annotation

Methods

compare :: Ann -> Ann -> Ordering #

(<) :: Ann -> Ann -> Bool #

(<=) :: Ann -> Ann -> Bool #

(>) :: Ann -> Ann -> Bool #

(>=) :: Ann -> Ann -> Bool #

max :: Ann -> Ann -> Ann #

min :: Ann -> Ann -> Ann #

Hashable Ann # 
Instance details

Defined in PlutusCore.Annotation

Methods

hashWithSalt :: Int -> Ann -> Int #

hash :: Ann -> Int #

AnnCase Ann # 
Instance details

Defined in PlutusCore.Annotation

AnnInline Ann # 
Instance details

Defined in PlutusCore.Annotation

Pretty Ann # 
Instance details

Defined in PlutusCore.Annotation

Methods

pretty :: Ann -> Doc ann #

prettyList :: [Ann] -> Doc ann #

type Rep Ann # 
Instance details

Defined in PlutusCore.Annotation

type Rep Ann = D1 ('MetaData "Ann" "PlutusCore.Annotation" "plutus-core-1.60.0.0-inplace" 'False) (C1 ('MetaCons "Ann" 'PrefixI 'True) ((S1 ('MetaSel ('Just "annInline") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Inline) :*: S1 ('MetaSel ('Just "annCase") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Case)) :*: (S1 ('MetaSel ('Just "annSrcSpans") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SrcSpans) :*: S1 ('MetaSel ('Just "annIsAsDataMatcher") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bool))))

data SrcSpan #

The span between two source locations.

This corresponds roughly to the SrcSpan used by GHC, but we define our own version so we don't have to depend on ghc to use it.

The line and column numbers are 1-based, and the unit is Unicode code point (or Char).

Constructors

SrcSpan 

Fields

Instances

Instances details
Generic SrcSpan # 
Instance details

Defined in PlutusCore.Annotation

Associated Types

type NumBits #

Pretty SrcSpans # 
Instance details

Defined in PlutusCore.Annotation

Methods

pretty :: SrcSpans -> Doc ann #

prettyList :: [SrcSpans] -> Doc ann #

type Element SrcSpans = SrcSpan

newtype InlineHints name a #

Constructors

InlineHints 

Fields

Instances

Instances details
Show (InlineHints name a) # 
Instance details

Defined in PlutusCore.Annotation

Methods

showsPrec :: Int -> InlineHints name a -> ShowS #

show :: InlineHints name a -> String #

showList :: [InlineHints name a] -> ShowS #

Default (InlineHints name a) # 
Instance details

Defined in PlutusCore.Annotation

Methods

def :: InlineHints name a #

data Inline #

Constructors

AlwaysInline

When calling PlutusIR.Compiler.Definitions.defineTerm to add a new term definition, if we annotation the var on the LHS of the definition with AlwaysInline, the inliner will always inline that var.

This is currently used to ensure builtin functions such as trace (when the remove-trace flag is on and trace is rewritten to const) are inlined, because the inliner would otherwise not inline them. To achieve that, we annotate the definition with AlwaysInline when defining trace, i.e., trace AlwaysInline = _ a -> a.

SafeToInline

Signaling to the compiler that a binding is safe to inline. This is useful for annotating strict bindings that aren't obviously safe to inline.

MayInline 

Instances

Instances details
Generic Inline # 
Instance details

Defined in PlutusCore.Annotation

Associated Types

type Rep Inline :: Type -> Type #

Methods

from :: Inline -> Rep Inline x #

to :: Rep Inline x -> Inline #

Show Inline # 
Instance details

Defined in PlutusCore.Annotation

Eq Inline # 
Instance details

Defined in PlutusCore.Annotation

Methods

(==) :: Inline -> Inline -> Bool #

(/=) :: Inline -> Inline -> Bool #

Ord Inline # 
Instance details

Defined in PlutusCore.Annotation

Hashable Inline # 
Instance details

Defined in PlutusCore.Annotation

Methods

hashWithSalt :: Int -> Inline -> Int #

hash :: Inline -> Int #

type Rep Inline # 
Instance details

Defined in PlutusCore.Annotation

type Rep Inline = D1 ('MetaData "Inline" "PlutusCore.Annotation" "plutus-core-1.60.0.0-inplace" 'False) (C1 ('MetaCons "AlwaysInline" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "SafeToInline" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "MayInline" 'PrefixI 'False) (U1 :: Type -> Type)))

class AnnInline a where #

Methods

annAlwaysInline :: a #

An annotation instructing the inliner to always inline a binding.

annSafeToInline :: a #

An annotation signaling to the inliner that a binding is safe to inline. The inlining decision is left to the inliner. This is useful for annotating strict bindings that aren't obviously safe to inline.

annMayInline :: a #

An annotation that leaves the inlining decision to the inliner.

Instances

Instances details
AnnInline Ann # 
Instance details

Defined in PlutusCore.Annotation

AnnInline () # 
Instance details

Defined in PlutusCore.Annotation

data Case #

Constructors

SafeToDrop

Signaling to the compiler that a case expression is safe to drop, so long as its binders are unused.

NotSafeToDrop 

Instances

Instances details
Generic Case # 
Instance details

Defined in PlutusCore.Annotation

Associated Types

type Rep Case :: Type -> Type #

Methods

from :: Case -> Rep Case x #

to :: Rep Case x -> Case #

Show Case # 
Instance details

Defined in PlutusCore.Annotation

Methods

showsPrec :: Int -> Case -> ShowS #

show :: Case -> String #

showList :: [Case] -> ShowS #

Eq Case # 
Instance details

Defined in PlutusCore.Annotation

Methods

(==) :: Case -> Case -> Bool #

(/=) :: Case -> Case -> Bool #

Ord Case # 
Instance details

Defined in PlutusCore.Annotation

Methods

compare :: Case -> Case -> Ordering #

(<) :: Case -> Case -> Bool #

(<=) :: Case -> Case -> Bool #

(>) :: Case -> Case -> Bool #

(>=) :: Case -> Case -> Bool #

max :: Case -> Case -> Case #

min :: Case -> Case -> Case #

Hashable Case # 
Instance details

Defined in PlutusCore.Annotation

Methods

hashWithSalt :: Int -> Case -> Int #

hash :: Case -> Int #

type Rep Case # 
Instance details

Defined in PlutusCore.Annotation

type Rep Case = D1 ('MetaData "Case" "PlutusCore.Annotation" "plutus-core-1.60.0.0-inplace" 'False) (C1 ('MetaCons "SafeToDrop" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "NotSafeToDrop" 'PrefixI 'False) (U1 :: Type -> Type))

class AnnCase a where #

Methods used to guide optimization of case expressions.

Methods

annSafeToDrop :: a #

An annotation signaling that the case expression is safe to drop, so long as its binders are unused.

annNotSafeToDrop :: a #

annIsSafeToDrop :: a -> Bool #

Instances

Instances details
AnnCase Ann # 
Instance details

Defined in PlutusCore.Annotation

AnnCase () # 
Instance details

Defined in PlutusCore.Annotation

data SourcePos #

The data type SourcePos represents source positions. It contains the name of the source file, a line number, and a column number. Source line and column positions change intensively during parsing, so we need to make them strict to avoid memory leaks.

Constructors

SourcePos 

Fields

data Pos #

Pos is the type for positive integers. This is used to represent line number, column number, and similar things like indentation level. Semigroup instance can be used to safely and efficiently add Poses together.

Since: megaparsec-5.0.0

Instances

Instances details
Text.Megaparsec.Pos

type Rep Pos = D1 ('MetaData "Pos" "Text.Megaparsec.Pos" "megaparsec-9.7.0-9IxnAL1Z5n8HX9bf04jh9I" 'True) (C1 ('MetaCons "Pos" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))

addSrcSpan :: SrcSpan -> Ann -> Ann #

Add an extra SrcSpan to existing SrcSpans of Ann

lineInSrcSpan :: Pos -> SrcSpan -> Bool #

Tells if a line (positive integer) falls inside a SrcSpan.