plutus-core-1.0.0.1: Language library for Plutus Core
Safe Haskell None
Language Haskell2010

PlutusCore.Builtin.Debug

Description

This module helps to visualize and debug the TypeScheme inference machinery from the Meaning module.

Synopsis

Documentation

elaborateDebug :: forall a j. ElaborateFromTo 0 j ( Term TyName Name DefaultUni DefaultFun ()) a => a -> a Source #

Instantiate type variables in the type of a value using ElaborateFromTo . Example usages:

>>> :t elaborateDebug False
elaborateDebug False :: Bool
>>> :t elaborateDebug $ \_ -> ()
elaborateDebug $ \_ -> ()
  :: Opaque
       (Term TyName Name DefaultUni DefaultFun ())
       (TyVarRep ('TyNameRep "a" 0))
     -> ()
>>> :t elaborateDebug $ Just ()
<interactive>:1:1: error:
    • No instance for ‘KnownTypeAst DefaultUni (Maybe ())’
      Which means
        ‘Maybe ()’
      is neither a built-in type, nor one of the control types.
      If it can be represented in terms of one of the built-in types
        then go add the instance (you may need a ‘KnownTypeIn’ one too)
        alongside the instance for the built-in type.
      Otherwise you may need to add a new built-in type
        (provided you're doing something that can be supported in principle)
    • In the expression: elaborateDebug $ Just ()
>>> :t elaborateDebug $ 0 + 42
<interactive>:1:18: error:
    • Built-in functions are not allowed to have constraints
      To fix this error instantiate all constrained type variables
    • In the second argument of ‘($)’, namely ‘0 + 42’
      In the expression: elaborateDebug $ 0 + 42

newtype Opaque val (rep :: Type ) Source #

The denotation of a term whose PLC type is encoded in rep (for example a type variable or an application of a type variable). I.e. the denotation of such a term is the term itself. This is because we have parametricity in Haskell, so we can't inspect a value whose type is, say, a bound variable, so we never need to convert such a term from Plutus Core to Haskell and back and instead can keep it intact.

Constructors

Opaque

Fields

Instances

Instances details
( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Bifunctor Opaque Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

bimap :: (a -> b) -> (c -> d) -> Opaque a c -> Opaque b d Source #

first :: (a -> b) -> Opaque a c -> Opaque b c Source #

second :: (b -> c) -> Opaque a b -> Opaque a c Source #

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Bitraversable Opaque Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Opaque a b -> f ( Opaque c d) Source #

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Bifoldable Opaque Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

bifold :: Monoid m => Opaque m m -> m Source #

bifoldMap :: Monoid m => (a -> m) -> (b -> m) -> Opaque a b -> m Source #

bifoldr :: (a -> c -> c) -> (b -> c -> c) -> c -> Opaque a b -> c Source #

bifoldl :: (c -> a -> c) -> (c -> b -> c) -> c -> Opaque a b -> c Source #

uni ~ UniOf val => ReadKnownIn uni val ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

readKnown :: Maybe cause -> val -> ReadKnownM cause ( Opaque val rep) Source #

uni ~ UniOf val => MakeKnownIn uni val ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.KnownType

Methods

makeKnown :: Maybe cause -> Opaque val rep -> MakeKnownM cause val Source #

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Monad ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Functor ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

fmap :: (a -> b) -> Opaque val a -> Opaque val b Source #

(<$) :: a -> Opaque val b -> Opaque val a Source #

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => MonadFail ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Applicative ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Foldable ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

fold :: Monoid m => Opaque val m -> m Source #

foldMap :: Monoid m => (a -> m) -> Opaque val a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Opaque val a -> m Source #

foldr :: (a -> b -> b) -> b -> Opaque val a -> b Source #

foldr' :: (a -> b -> b) -> b -> Opaque val a -> b Source #

foldl :: (b -> a -> b) -> b -> Opaque val a -> b Source #

foldl' :: (b -> a -> b) -> b -> Opaque val a -> b Source #

foldr1 :: (a -> a -> a) -> Opaque val a -> a Source #

foldl1 :: (a -> a -> a) -> Opaque val a -> a Source #

toList :: Opaque val a -> [a] Source #

null :: Opaque val a -> Bool Source #

length :: Opaque val a -> Int Source #

elem :: Eq a => a -> Opaque val a -> Bool Source #

maximum :: Ord a => Opaque val a -> a Source #

minimum :: Ord a => Opaque val a -> a Source #

sum :: Num a => Opaque val a -> a Source #

product :: Num a => Opaque val a -> a Source #

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Traversable ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

traverse :: Applicative f => (a -> f b) -> Opaque val a -> f ( Opaque val b) Source #

sequenceA :: Applicative f => Opaque val (f a) -> f ( Opaque val a) Source #

mapM :: Monad m => (a -> m b) -> Opaque val a -> m ( Opaque val b) Source #

sequence :: Monad m => Opaque val (m a) -> m ( Opaque val a) Source #

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => Alternative ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => MonadPlus ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoRegularlyAppliedHkVarsMsg :: Constraint ) => MonadIO ( Opaque val) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

KnownTypeAst uni rep => KnownTypeAst uni ( Opaque val rep :: Type ) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Associated Types

type ToHoles ( Opaque val rep) :: [ Hole ] Source #

type ToBinds ( Opaque val rep) :: [ Some TyNameRep ] Source #

Methods

toTypeAst :: proxy ( Opaque val rep) -> Type0 TyName uni () Source #

( TypeError NoConstraintsErrMsg :: Constraint ) => Bounded ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Enum ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Eq ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Integral ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Methods

quot :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

rem :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

div :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

mod :: Opaque val rep -> Opaque val rep -> Opaque val rep Source #

quotRem :: Opaque val rep -> Opaque val rep -> ( Opaque val rep, Opaque val rep) Source #

divMod :: Opaque val rep -> Opaque val rep -> ( Opaque val rep, Opaque val rep) Source #

toInteger :: Opaque val rep -> Integer Source #

( TypeError NoConstraintsErrMsg :: Constraint ) => Num ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Ord ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Real ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Ix ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Semigroup ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

( TypeError NoConstraintsErrMsg :: Constraint ) => Monoid ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

Pretty val => Pretty ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

HasConstant val => HasConstant ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

type ToHoles ( Opaque val rep :: Type ) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles ( Opaque val rep :: Type ) = '[ RepHole rep :: Hole ]
type ToBinds ( Opaque val rep :: Type ) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds ( Opaque val rep :: Type ) = ToBinds rep
type UniOf ( Opaque val rep) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

type UniOf ( Opaque val rep) = UniOf val

newtype SomeConstant uni (rep :: Type ) Source #

For unlifting from the Constant constructor when the stored value is of a monomorphic built-in type

The rep parameter specifies how the type looks on the PLC side (i.e. just like with Opaque val rep ).

data TyNameRep (kind :: Type ) Source #

Representation of a type variable: its name and unique and an implicit kind.

Instances

Instances details
KnownMonotype val args res a => KnownPolytype ('[] :: [ Some TyNameRep ]) val args res (a :: k) Source #

Once we've run out of type-level arguments, we start handling term-level ones.

Instance details

Defined in PlutusCore.Builtin.Meaning

( KnownSymbol name, KnownNat uniq, KnownKind kind, KnownPolytype binds val args res a) => KnownPolytype (' Some (' TyNameRep name uniq :: TyNameRep kind) ': binds) val args res (a :: k) Source #

Every type-level argument becomes a TypeSchemeAll .

Instance details

Defined in PlutusCore.Builtin.Meaning

( TypeError NoStandalonePolymorphicDataErrMsg :: Constraint ) => Contains uni ( TyVarRep :: TyNameRep kind -> kind) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

data family TyVarRep (name :: TyNameRep kind) :: kind Source #

Representation of an intrinsically-kinded type variable: a name.

Instances

Instances details
(name ~ (' TyNameRep text uniq :: TyNameRep a), KnownSymbol text, KnownNat uniq) => KnownTypeAst uni ( TyVarRep name :: a) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

( TypeError NoStandalonePolymorphicDataErrMsg :: Constraint ) => Contains uni ( TyVarRep :: TyNameRep kind -> kind) Source #
Instance details

Defined in PlutusCore.Builtin.Polymorphism

type ToHoles ( TyVarRep name :: a) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles ( TyVarRep name :: a) = '[] :: [ Hole ]
type ToBinds ( TyVarRep name :: a) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds ( TyVarRep name :: a) = '[' Some name]

data family TyAppRep (fun :: dom -> cod) (arg :: dom) :: cod Source #

Representation of an intrinsically-kinded type application: a function and an argument.

Instances

Instances details
( KnownTypeAst uni fun, KnownTypeAst uni arg) => KnownTypeAst uni ( TyAppRep fun arg :: a) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

Methods

toTypeAst :: proxy ( TyAppRep fun arg) -> Type TyName uni () Source #

type ToHoles ( TyAppRep fun arg :: a) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToHoles ( TyAppRep fun arg :: a) = '[ RepHole fun :: Hole , RepHole arg :: Hole ]
type ToBinds ( TyAppRep fun arg :: a) Source #
Instance details

Defined in PlutusCore.Builtin.KnownTypeAst

type ToBinds ( TyAppRep fun arg :: a) = Merge ( ToBinds fun) ( ToBinds arg)

data family TyForallRep (name :: TyNameRep kind) (a :: Type ) :: Type Source #

Representation of of an intrinsically-kinded universal quantifier: a bound name and a body.