Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module helps to visualize and debug the TypeScheme
inference machinery from the
Meaning
module.
Synopsis
- elaborateDebug :: forall a j. ElaborateFromTo 0 j (Term TyName Name DefaultUni DefaultFun ()) a => a -> a
- module PlutusCore.Name
- module PlutusCore.Default
- module PlutusCore.Core
- newtype Opaque val (rep :: Type) = Opaque {
- unOpaque :: val
- newtype SomeConstant uni (rep :: Type) = SomeConstant {
- unSomeConstant :: Some (ValueOf uni)
- data TyNameRep (kind :: Type) = TyNameRep Symbol Nat
- data family TyVarRep (name :: TyNameRep kind) :: kind
- data family TyAppRep (fun :: dom -> cod) (arg :: dom) :: cod
- data family TyForallRep (name :: TyNameRep kind) (a :: Type) :: Type
- module PlutusCore.Builtin.Elaborate
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
module PlutusCore.Name
module PlutusCore.Default
module PlutusCore.Core
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.
Instances
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Bitraversable Opaque Source # | |
Defined in PlutusCore.Builtin.Polymorphism bitraverse :: Applicative f => (a -> f c) -> (b -> f d) -> Opaque a b -> f (Opaque c d) Source # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Bifoldable Opaque Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Bifunctor Opaque Source # | |
uni ~ UniOf val => ReadKnownIn uni val (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.KnownType | |
uni ~ UniOf val => MakeKnownIn uni val (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.KnownType | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Monad (Opaque val) Source # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Functor (Opaque val) Source # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => MonadFail (Opaque val) Source # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Applicative (Opaque val) Source # | |
Defined in PlutusCore.Builtin.Polymorphism pure :: a -> Opaque val a Source # (<*>) :: Opaque val (a -> b) -> Opaque val a -> Opaque val b Source # liftA2 :: (a -> b -> c) -> Opaque val a -> Opaque val b -> Opaque val c Source # (*>) :: Opaque val a -> Opaque val b -> Opaque val b Source # (<*) :: Opaque val a -> Opaque val b -> Opaque val a Source # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Foldable (Opaque val) Source # | |
Defined in PlutusCore.Builtin.Polymorphism 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 # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Traversable (Opaque val) Source # | |
Defined in PlutusCore.Builtin.Polymorphism 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) => MonadIO (Opaque val) Source # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => Alternative (Opaque val) Source # | |
(TypeError NoRegularlyAppliedHkVarsMsg :: Constraint) => MonadPlus (Opaque val) Source # | |
KnownTypeAst uni rep => KnownTypeAst uni (Opaque val rep :: Type) Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Bounded (Opaque val rep) Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Enum (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism succ :: Opaque val rep -> Opaque val rep Source # pred :: Opaque val rep -> Opaque val rep Source # toEnum :: Int -> Opaque val rep Source # fromEnum :: Opaque val rep -> Int Source # enumFrom :: Opaque val rep -> [Opaque val rep] Source # enumFromThen :: Opaque val rep -> Opaque val rep -> [Opaque val rep] Source # enumFromTo :: Opaque val rep -> Opaque val rep -> [Opaque val rep] Source # enumFromThenTo :: Opaque val rep -> Opaque val rep -> Opaque val rep -> [Opaque val rep] Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Eq (Opaque val rep) Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Integral (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism 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 # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Num (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism (+) :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # (-) :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # (*) :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # negate :: Opaque val rep -> Opaque val rep Source # abs :: Opaque val rep -> Opaque val rep Source # signum :: Opaque val rep -> Opaque val rep Source # fromInteger :: Integer -> Opaque val rep Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Ord (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism compare :: Opaque val rep -> Opaque val rep -> Ordering Source # (<) :: Opaque val rep -> Opaque val rep -> Bool Source # (<=) :: Opaque val rep -> Opaque val rep -> Bool Source # (>) :: Opaque val rep -> Opaque val rep -> Bool Source # (>=) :: Opaque val rep -> Opaque val rep -> Bool Source # max :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # min :: Opaque val rep -> Opaque val rep -> Opaque val rep Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Real (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism toRational :: Opaque val rep -> Rational Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Ix (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism range :: (Opaque val rep, Opaque val rep) -> [Opaque val rep] Source # index :: (Opaque val rep, Opaque val rep) -> Opaque val rep -> Int Source # unsafeIndex :: (Opaque val rep, Opaque val rep) -> Opaque val rep -> Int Source # inRange :: (Opaque val rep, Opaque val rep) -> Opaque val rep -> Bool Source # rangeSize :: (Opaque val rep, Opaque val rep) -> Int Source # unsafeRangeSize :: (Opaque val rep, Opaque val rep) -> Int Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Semigroup (Opaque val rep) Source # | |
(TypeError NoConstraintsErrMsg :: Constraint) => Monoid (Opaque val rep) Source # | |
Pretty val => Pretty (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism | |
HasConstant val => HasConstant (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism asConstant :: AsUnliftingError err => Maybe cause -> Opaque val rep -> Either (ErrorWithCause err cause) (Some (ValueOf (UniOf (Opaque val rep)))) Source # fromConstant :: Some (ValueOf (UniOf (Opaque val rep))) -> Opaque val rep Source # | |
type ToHoles (Opaque val rep :: Type) Source # | |
type ToBinds (Opaque val rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
type UniOf (Opaque val rep) Source # | |
Defined in PlutusCore.Builtin.Polymorphism |
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
).
SomeConstant | |
|
Instances
HasConstantIn uni val => ReadKnownIn uni val (SomeConstant uni rep) Source # | |
Defined in PlutusCore.Builtin.KnownType readKnown :: Maybe cause -> val -> ReadKnownM cause (SomeConstant uni rep) Source # | |
HasConstantIn uni val => MakeKnownIn uni val (SomeConstant uni rep) Source # | |
Defined in PlutusCore.Builtin.KnownType makeKnown :: Maybe cause -> SomeConstant uni rep -> MakeKnownM cause val Source # | |
KnownTypeAst uni rep => KnownTypeAst uni (SomeConstant uni rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst type ToHoles (SomeConstant uni rep) :: [Hole] Source # type ToBinds (SomeConstant uni rep) :: [Some TyNameRep] Source # | |
type ToHoles (SomeConstant uni rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
type ToBinds (SomeConstant uni rep :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst |
data TyNameRep (kind :: Type) Source #
Representation of a type variable: its name and unique and an implicit kind.
Instances
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. |
Defined in PlutusCore.Builtin.Meaning knownPolytype :: TypeScheme val args res Source # knownPolyruntime :: RuntimeScheme (Length args) Source # | |
(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 |
Defined in PlutusCore.Builtin.Meaning knownPolytype :: TypeScheme val args res Source # knownPolyruntime :: RuntimeScheme (Length args) Source # | |
(TypeError NoStandalonePolymorphicDataErrMsg :: Constraint) => Contains uni (TyVarRep :: TyNameRep kind -> kind) Source # | |
data family TyVarRep (name :: TyNameRep kind) :: kind Source #
Representation of an intrinsically-kinded type variable: a name.
Instances
(name ~ ('TyNameRep text uniq :: TyNameRep a), KnownSymbol text, KnownNat uniq) => KnownTypeAst uni (TyVarRep name :: a) Source # | |
(TypeError NoStandalonePolymorphicDataErrMsg :: Constraint) => Contains uni (TyVarRep :: TyNameRep kind -> kind) Source # | |
type ToHoles (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
type ToBinds (TyVarRep name :: a) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst |
data family TyAppRep (fun :: dom -> cod) (arg :: dom) :: cod Source #
Representation of an intrinsically-kinded type application: a function and an argument.
Instances
(KnownTypeAst uni fun, KnownTypeAst uni arg) => KnownTypeAst uni (TyAppRep fun arg :: a) Source # | |
type ToHoles (TyAppRep fun arg :: a) Source # | |
type ToBinds (TyAppRep fun arg :: a) Source # | |
data family TyForallRep (name :: TyNameRep kind) (a :: Type) :: Type Source #
Representation of of an intrinsically-kinded universal quantifier: a bound name and a body.
Instances
(name ~ ('TyNameRep text uniq :: TyNameRep kind), KnownSymbol text, KnownNat uniq, KnownKind kind, KnownTypeAst uni a) => KnownTypeAst uni (TyForallRep name a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst type ToHoles (TyForallRep name a) :: [Hole] Source # type ToBinds (TyForallRep name a) :: [Some TyNameRep] Source # | |
type ToHoles (TyForallRep name a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst | |
type ToBinds (TyForallRep name a :: Type) Source # | |
Defined in PlutusCore.Builtin.KnownTypeAst |
module PlutusCore.Builtin.Elaborate