| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Plutarch.Prelude
Contents
- Boolean
- Bytestring
- Cryptographic primitives
- Data encoding
- Integer
- Opaque
- String
- Unit
- DataRepr
- Either
- Enumerable and Countable
- Eq and Ord
- Fixed point
- IsData
- Lifting and lowering
- Lists
- Arrays
- PlutusType
- Numeric
- Other
- Show
- Term and related functionality
- Conversion
- Maybe
- Pair
- Rational
- TermCont
- Tracing
- Semigroup and Monoid
- Unrolling utilities
- Validation
Synopsis
- data PBool (s :: S)
- pand' :: forall (s :: S). Term s (PBool :--> (PBool :--> PBool))
- pcond :: forall (a :: S -> Type) (s :: S). [(Term s PBool, Term s a)] -> Term s a -> Term s a
- pif :: forall (a :: S -> Type) (s :: S). Term s PBool -> Term s a -> Term s a -> Term s a
- pif' :: forall (a :: S -> Type) (s :: S). Term s (PBool :--> (a :--> (a :--> a)))
- pnot :: forall (s :: S). Term s (PBool :--> PBool)
- por' :: forall (s :: S). Term s (PBool :--> (PBool :--> PBool))
- (#&&) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool
- (#||) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool
- data PByte (s :: S)
- data PByteString (s :: S)
- data PLogicOpSemantics (s :: S)
- pandBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString)))
- pbyteToInteger :: forall (s :: S). Term s (PByte :--> PInteger)
- pcomplementBS :: forall (s :: S). Term s (PByteString :--> PByteString)
- pconsBS :: forall (s :: S). Term s (PByte :--> (PByteString :--> PByteString))
- phexByteStr :: forall (s :: S). HasCallStack => String -> Term s PByteString
- pindexBS :: forall (s :: S). Term s (PByteString :--> (PInteger :--> PByte))
- pintegerToByte :: forall (s :: S). Term s (PInteger :--> PByte)
- plengthBS :: forall (s :: S). Term s (PByteString :--> PInteger)
- porBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString)))
- ppadding :: forall (s :: S). Term s PLogicOpSemantics
- preplicateBS :: forall (s :: S). Term s (PInteger :--> (PByte :--> PByteString))
- psliceBS :: forall (s :: S). Term s (PInteger :--> (PInteger :--> (PByteString :--> PByteString)))
- ptruncation :: forall (s :: S). Term s PLogicOpSemantics
- pxorBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString)))
- psha2_256 :: forall (s :: S). Term s (PByteString :--> PByteString)
- psha3_256 :: forall (s :: S). Term s (PByteString :--> PByteString)
- newtype PAsData (a :: S -> Type) (s :: S) = PAsData (Term s a)
- data PBuiltinList (a :: S -> Type) (s :: S)
- = PCons (Term s a) (Term s (PBuiltinList a))
- | PNil
- data PBuiltinPair (a :: S -> Type) (b :: S -> Type) (s :: S) = PBuiltinPair (Term s a) (Term s b)
- newtype PData (s :: S) = PData (Term s PData)
- pasByteStr :: forall (s :: S). Term s (PData :--> PByteString)
- pasConstr :: forall (s :: S). Term s (PData :--> PBuiltinPair PInteger (PBuiltinList PData))
- pasInt :: forall (s :: S). Term s (PData :--> PInteger)
- pasList :: forall (s :: S). Term s (PData :--> PBuiltinList PData)
- pasMap :: forall (s :: S). Term s (PData :--> PBuiltinList (PBuiltinPair PData PData))
- pchooseData :: forall (s :: S) (a :: S -> Type). Term s (PData :--> (a :--> (a :--> (a :--> (a :--> (a :--> a))))))
- pchooseListBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PBuiltinList a :--> (b :--> (b :--> b)))
- pconsBuiltin :: forall (s :: S) (a :: S -> Type). Term s (a :--> (PBuiltinList a :--> PBuiltinList a))
- pconstrBuiltin :: forall (s :: S). Term s (PInteger :--> (PBuiltinList PData :--> PAsData (PBuiltinPair PInteger (PBuiltinList PData))))
- pfstBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PBuiltinPair a b :--> a)
- pheadBuiltin :: forall (s :: S) (a :: S -> Type). Term s (PBuiltinList a :--> a)
- plistData :: forall (s :: S). Term s (PBuiltinList PData :--> PData)
- pnullBuiltin :: forall (s :: S) (a :: S -> Type). Term s (PBuiltinList a :--> PBool)
- ppairDataBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PAsData a :--> (PAsData b :--> PBuiltinPair (PAsData a) (PAsData b)))
- pserialiseData :: forall (s :: S). Term s (PData :--> PByteString)
- psndBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PBuiltinPair a b :--> b)
- ptailBuiltin :: forall (s :: S) (a :: S -> Type). Term s (PBuiltinList a :--> PBuiltinList a)
- pheadTailBuiltin :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Term s (PBuiltinList a) -> (Term s a -> Term s (PBuiltinList a) -> Term s b) -> Term s b
- data PInteger (s :: S)
- newtype POpaque (s :: S) = POpaque (Term s POpaque)
- popaque :: forall (s :: S) (a :: S -> Type). Term s a -> Term s POpaque
- data PString (s :: S)
- pdecodeUtf8 :: forall (s :: S). Term s (PByteString :--> PString)
- pencodeUtf8 :: forall (s :: S). Term s (PString :--> PByteString)
- data PUnit (s :: S) = PUnit
- class PDataFields (a :: S -> Type)
- data PDataRecord (as :: [PLabeledType]) (s :: S)
- data PDataSum (defs :: [[PLabeledType]]) (s :: S)
- data PLabeledType = Symbol := (S -> Type)
- data PlutusTypeData
- pdcons :: forall (label :: Symbol) (a :: S -> Type) (l :: [PLabeledType]) (s :: S). Term s (PAsData a :--> (PDataRecord l :--> PDataRecord ((label ':= a) ': l)))
- pdnil :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType]))
- pfield :: forall (name :: Symbol) (b :: S -> Type) (p :: S -> Type) (s :: S) (a :: S -> Type) (as :: [PLabeledType]) (n :: Nat). (PDataFields p, as ~ PFields p, n ~ PLabelIndex name as, KnownNat n, a ~ PUnLabel (IndexList n as), PFromDataable a b) => Term s (p :--> b)
- pletFields :: forall (fs :: [Symbol]) (a :: S -> Type) (s :: S) (b :: S -> Type) (ps :: [PLabeledType]) (bs :: [ToBind]). (PDataFields a, ps ~ PFields a, bs ~ Bindings ps fs, BindFields ps bs) => Term s a -> (HRecOf a fs s -> Term s b) -> Term s b
- data PEither (a :: S -> Type) (b :: S -> Type) (s :: S)
- class POrd a => PCountable (a :: S -> Type) where
- psuccessor :: forall (s :: S). Term s (a :--> a)
- psuccessorN :: forall (s :: S). Term s (PPositive :--> (a :--> a))
- class PCountable a => PEnumerable (a :: S -> Type) where
- ppredecessor :: forall (s :: S). Term s (a :--> a)
- ppredecessorN :: forall (s :: S). Term s (PPositive :--> (a :--> a))
- class PEq (t :: S -> Type) where
- class PEq t => POrd (t :: S -> Type) where
- (#>) :: forall (a :: S -> Type) (s :: S). POrd a => Term s a -> Term s a -> Term s PBool
- (#>=) :: forall (a :: S -> Type) (s :: S). POrd a => Term s a -> Term s a -> Term s PBool
- pfixHoisted :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (((a :--> b) :--> (a :--> b)) :--> (a :--> b))
- pfix :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b)
- pfixInline :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b)
- class PIsData (a :: S -> Type) where
- pdata :: forall (a :: S -> Type) (s :: S). PIsData a => Term s a -> Term s (PAsData a)
- pforgetData :: forall (s :: S) (a :: S -> Type). Term s (PAsData a) -> Term s PData
- pfromData :: forall (a :: S -> Type) (s :: S). PIsData a => Term s (PAsData a) -> Term s a
- class PlutusType a => PLiftable (a :: S -> Type) where
- type AsHaskell (a :: S -> Type)
- type PlutusRepr (a :: S -> Type)
- haskToRepr :: AsHaskell a -> PlutusRepr a
- reprToHask :: PlutusRepr a -> Either LiftError (AsHaskell a)
- reprToPlut :: forall (s :: S). PlutusRepr a -> PLifted s a
- plutToRepr :: (forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
- data DeriveDataPLiftable (a :: S -> Type) h (s :: S)
- data DeriveNewtypePLiftable (wrapper :: S -> Type) h (s :: S)
- newtype DeriveAsDataRec (a :: S -> Type) (s :: S) = DeriveAsDataRec {
- unDeriveAsDataRec :: a s
- newtype DeriveAsDataStruct (a :: S -> Type) (s :: S) = DeriveAsDataStruct {
- unDeriveAsDataStruct :: a s
- newtype DeriveAsSOPRec (a :: S -> Type) (s :: S) = DeriveAsSOPRec {
- unDeriveAsSOPRec :: a s
- newtype DeriveAsSOPStruct (a :: S -> Type) (s :: S) = DeriveAsSOPStruct {
- unDeriveAsSOPStruct :: a s
- newtype PLifted (s :: S) (a :: S -> Type) = PLifted (Term s POpaque)
- reprToPlutUni :: forall (a :: S -> Type) (s :: S). Includes DefaultUni (PlutusRepr a) => PlutusRepr a -> PLifted s a
- plutToReprUni :: forall (a :: S -> Type). KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) => (forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a)
- pconstant :: forall (a :: S -> Type) (s :: S). PLiftable a => AsHaskell a -> Term s a
- plift :: forall (a :: S -> Type). PLiftable a => (forall (s :: S). Term s a) -> AsHaskell a
- type family PElemConstraint (list :: (S -> Type) -> S -> Type) (a :: S -> Type)
- type PIsListLike (list :: (S -> Type) -> S -> Type) (a :: S -> Type) = (PListLike list, PElemConstraint list a)
- class PListLike (list :: (S -> Type) -> S -> Type)
- data PList (a :: S -> Type) (s :: S)
- pelem :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PIsListLike list a, PEq a) => Term s (a :--> (list a :--> PBool))
- pelemAt :: forall (l :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike l a => Term s (PInteger :--> (l a :--> a))
- pfind :: forall (l :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike l a => Term s ((a :--> PBool) :--> (l a :--> PMaybe a))
- plistEquals :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PIsListLike list a, PEq a) => Term s (list a :--> (list a :--> PBool))
- puncons :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (list a :--> PMaybe (PPair a (list a)))
- pzip :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b, PElemConstraint list (PPair a b)) => Term s (list a :--> (list b :--> list (PPair a b)))
- (#!!) :: forall (l :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike l a => Term s (l a) -> Term s PInteger -> Term s a
- pall :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s ((a :--> PBool) :--> (list a :--> PBool))
- pany :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s ((a :--> PBool) :--> (list a :--> PBool))
- pconcat :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (list a :--> (list a :--> list a))
- pcons :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (a :--> (list a :--> list a))
- pdrop :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Natural -> Term s (list a) -> Term s (list a)
- pelimList :: forall (a :: S -> Type) (s :: S) (r :: S -> Type). (PListLike list, PElemConstraint list a) => (Term s a -> Term s (list a) -> Term s r) -> Term s r -> Term s (list a) -> Term s r
- pfilter :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s ((a :--> PBool) :--> (list a :--> list a))
- pfoldl :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (b :: S -> Type). PIsListLike list a => Term s ((b :--> (a :--> b)) :--> (b :--> (list a :--> b)))
- pfoldr :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (b :: S -> Type). PIsListLike list a => Term s ((a :--> (b :--> b)) :--> (b :--> (list a :--> b)))
- pfoldrLazy :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (b :: S -> Type). PIsListLike list a => Term s ((a :--> (PDelayed b :--> b)) :--> (b :--> (list a :--> b)))
- phead :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a :--> a)
- plength :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (list a :--> PInteger)
- pmap :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b) => Term s ((a :--> b) :--> (list a :--> list b))
- pnil :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a)
- pnull :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a :--> PBool)
- precList :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (r :: S -> Type). PIsListLike list a => (Term s (list a :--> r) -> Term s a -> Term s (list a) -> Term s r) -> (Term s (list a :--> r) -> Term s r) -> Term s (list a :--> r)
- psingleton :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (a :--> list a)
- ptail :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a :--> list a)
- ptryIndex :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Natural -> Term s (list a) -> Term s a
- pzipWith :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b, PElemConstraint list c) => Term s ((a :--> (b :--> c)) :--> (list a :--> (list b :--> list c)))
- pzipWith' :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b, PElemConstraint list c) => (Term s a -> Term s b -> Term s c) -> Term s (list a :--> (list b :--> list c))
- data PArray (a :: S -> Type) (s :: S)
- plengthOfArray :: forall (a :: S -> Type) (s :: S). Term s (PArray a :--> PInteger)
- pindexArray :: forall (a :: S -> Type) (s :: S). Term s (PArray a :--> (PInteger :--> a))
- plistToArray :: forall (a :: S -> Type) (s :: S). Term s (PBuiltinList a :--> PArray a)
- class (PInner a ~ DerivedPInner (DPTStrat a) a, PlutusTypeStrat (DPTStrat a), PlutusTypeStratConstraint (DPTStrat a) a, PlutusType a) => DerivePlutusType (a :: S -> Type) where
- class PlutusType (a :: S -> Type) where
- pcon :: forall a (s :: S). PlutusType a => a s -> Term s a
- pmatch :: forall a (s :: S) (b :: S -> Type). PlutusType a => Term s a -> (a s -> Term s b) -> Term s b
- data PlutusTypeNewtype
- data PlutusTypeScott
- newtype DeriveNewtypePlutusType (a :: S -> Type) (s :: S) = DeriveNewtypePlutusType (a s)
- newtype DeriveFakePlutusType (a :: S -> Type) (s :: S) = DeriveFakePlutusType (a s)
- data Positive
- data PPositive (s :: S)
- data PNatural (s :: S)
- class PAdditiveSemigroup (a :: S -> Type) where
- class PAdditiveSemigroup a => PAdditiveMonoid (a :: S -> Type) where
- class PAdditiveMonoid a => PAdditiveGroup (a :: S -> Type) where
- class PMultiplicativeSemigroup (a :: S -> Type) where
- class PMultiplicativeSemigroup a => PMultiplicativeMonoid (a :: S -> Type) where
- class (PAdditiveGroup a, PMultiplicativeMonoid a) => PRing (a :: S -> Type) where
- pfromInteger :: forall (s :: S). Integer -> Term s a
- class (PRing a, POrd a) => PIntegralDomain (a :: S -> Type) where
- pquot :: forall (s :: S). Term s (PInteger :--> (PInteger :--> PInteger))
- prem :: forall (s :: S). Term s (PInteger :--> (PInteger :--> PInteger))
- pdiv :: forall (s :: S). Term s (PInteger :--> (PInteger :--> PInteger))
- pmod :: forall (s :: S). Term s (PInteger :--> (PInteger :--> PInteger))
- ppositive :: forall (s :: S). Term s (PInteger :--> PMaybe PPositive)
- ptryPositive :: forall (s :: S). Term s (PInteger :--> PPositive)
- pnatural :: forall (s :: S). Term s (PInteger :--> PMaybe PNatural)
- ptryNatural :: forall (s :: S). Term s (PInteger :--> PNatural)
- ppositiveToNatural :: forall (s :: S). Term s (PPositive :--> PNatural)
- pinl :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s a -> (Term s a -> Term s b) -> Term s b
- plam :: forall (c :: S -> Type). (PLamN a b s, HasCallStack) => (Term s c -> a) -> Term s (c :--> b)
- newtype PForall (b :: a -> S -> Type) (s :: S) = PForall (forall (x :: a). Term s (b x))
- class PShow (t :: S -> Type) where
- pshow :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s PString
- data Term (s :: S) (a :: S -> Type)
- data S
- data PDelayed (a :: S -> Type) (s :: S)
- papp :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (a :--> b) -> Term s a -> Term s b
- pdelay :: forall (s :: S) (a :: S -> Type). Term s a -> Term s (PDelayed a)
- pforce :: forall (s :: S) (a :: S -> Type). Term s (PDelayed a) -> Term s a
- perror :: forall (s :: S) (a :: S -> Type). Term s a
- phoistAcyclic :: forall (a :: S -> Type) (s :: S). HasCallStack => (forall (s' :: S). Term s' a) -> Term s a
- plet :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s a -> (Term s a -> Term s b) -> Term s b
- pthrow :: forall (s :: S) (a :: S -> Type). HasCallStack => Text -> Term s a
- (#) :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (a :--> b) -> Term s a -> Term s b
- (#$) :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (a :--> b) -> Term s a -> Term s b
- data ((a :: S -> Type) :--> (b :: S -> Type)) (s :: S)
- type family PSubtype (a :: S -> Type) (b :: S -> Type) where ...
- class PSubtype a b => PTryFrom (a :: S -> Type) (b :: S -> Type) where
- ptryFrom :: forall (b :: S -> Type) (a :: S -> Type) (s :: S) (r :: S -> Type). PTryFrom a b => Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r
- pupcast :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). PSubtype a b => Term s b -> Term s a
- pto :: forall (a :: S -> Type) (s :: S). Term s a -> Term s (PInner a)
- data PMaybe (a :: S -> Type) (s :: S)
- data PPair (a :: S -> Type) (b :: S -> Type) (s :: S) = PPair (Term s a) (Term s b)
- data PRational (s :: S) = PRational (Term s PInteger) (Term s PPositive)
- pdenominator :: forall (s :: S). Term s (PRational :--> PPositive)
- pnumerator :: forall (s :: S). Term s (PRational :--> PInteger)
- pround :: forall (s :: S). Term s (PRational :--> PInteger)
- newtype TermCont (a :: S) b where
- pguardC :: forall {r :: S -> Type} (s :: S). Term s PString -> Term s PBool -> TermCont s ()
- pguardC' :: forall (s :: S) (a :: S -> Type). Term s a -> Term s PBool -> TermCont s ()
- pletC :: forall {r :: S -> Type} (s :: S) (a :: S -> Type). Term s a -> TermCont s (Term s a)
- pletFieldsC :: forall (fs :: [Symbol]) (a :: S -> Type) (s :: S) (b :: S -> Type) (ps :: [PLabeledType]) (bs :: [ToBind]). (PDataFields a, ps ~ PFields a, bs ~ Bindings ps fs, BindFields ps bs) => Term s a -> TermCont s (HRec (BoundTerms ps bs s))
- pmatchC :: forall {r :: S -> Type} a (s :: S). PlutusType a => Term s a -> TermCont s (a s)
- ptraceC :: forall {r :: S -> Type} (s :: S). Term s PString -> TermCont s ()
- ptryFromC :: forall (b :: S -> Type) (r :: S -> Type) (a :: S -> Type) (s :: S). PTryFrom a b => Term s a -> TermCont s (Term s b, Reduce (PTryFromExcess a b s))
- unTermCont :: forall (a :: S -> Type) (s :: S). TermCont s (Term s a) -> Term s a
- tcont :: forall a (s :: S) (r :: S -> Type). ((a -> Term s r) -> Term s r) -> TermCont s a
- ptraceDebug :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a -> Term s a
- ptraceDebugError :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a
- ptraceDebugIfFalse :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
- ptraceDebugIfTrue :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
- ptraceDebugShowId :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a
- ptraceInfo :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a -> Term s a
- ptraceInfoError :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a
- ptraceInfoIfFalse :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
- ptraceInfoIfTrue :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool
- ptraceInfoShowId :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a
- class PSemigroup (a :: S -> Type) where
- class PSemigroup a => PMonoid (a :: S -> Type) where
- newtype PAnd (a :: S -> Type) (s :: S) = PAnd (Term s a)
- newtype POr (a :: S -> Type) (s :: S) = POr (Term s a)
- newtype PXor (a :: S -> Type) (s :: S) = PXor (Term s a)
- punrollBound :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Integer -> Term s (a :--> b) -> (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b)
- punrollBound' :: forall (a :: S -> Type) (b :: S -> Type) c (s :: S). Integer -> (c -> Term s (a :--> b)) -> ((c -> Term s (a :--> b)) -> c -> Term s (a :--> b)) -> c -> Term s (a :--> b)
- punrollUnbound :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Integer -> (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b)
- punrollUnboundWhole :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Integer -> (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b)
- class PValidateData (a :: S -> Type) where
- newtype Don'tValidate (a :: S -> Type) (s :: S) = Don'tValidate {
- unDon'tValidate :: a s
- newtype DeriveNewtypePValidateData (a :: S -> Type) (b :: S -> Type) (s :: S) = DeriveNewtypePValidateData (a s)
- pparseData :: forall (a :: S -> Type) (s :: S). (PIsData a, PValidateData a) => Term s PData -> Term s (PAsData a)
Boolean
Builtin Plutus boolean.
Since: 1.10.0
Instances
pand' :: forall (s :: S). Term s (PBool :--> (PBool :--> PBool)) Source #
As pand, but strict.
Since: 1.10.0
pcond :: forall (a :: S -> Type) (s :: S). [(Term s PBool, Term s a)] -> Term s a -> Term s a Source #
Essentially multi-way pif. More precisely, given a list of
condition-action pairs, and an 'action of last resort', construct a
left-to-right 'chain' of pifs, using the conditions to determine which
action gets taken. The 'action of last resort' finishes the 'chain'. For
example:
pcond [(cond1, act1), (cond2, act2)] act3
does the same thing as
pif cond1 act1 (pif cond2 act2 act3)
Since: 1.10.0
pif :: forall (a :: S -> Type) (s :: S). Term s PBool -> Term s a -> Term s a -> Term s a Source #
Lazy if-then-else.
Since: 1.10.0
pif' :: forall (a :: S -> Type) (s :: S). Term s (PBool :--> (a :--> (a :--> a))) Source #
Deprecated: Use pif instead
Strict if-then-else. Emits slightly less code than the lazy version.
Since: 1.10.0
por' :: forall (s :: S). Term s (PBool :--> (PBool :--> PBool)) Source #
As por, but strict.
Since: 1.10.0
(#&&) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool infixr 3 Source #
Lazy AND for terms.
Since: 1.10.0
(#||) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool infixr 2 Source #
Lazy OR for terms.
Since: 1.10.0
Bytestring
A Plutarch-level representation of bytes.
Note =
This type is intentionally quite restrictive, as it's not really meant to be
computed with. Instead, it ensures certain operations' type safety while also
allowing more sensible signatures. If you want to do anything with PBytes,
we recommend converting them to PIntegers first.
Since: 1.10.0
Instances
| PEq PByte Source # | Since: 1.10.0 | ||||||||
| PLiftable PByte Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PByte -> PlutusRepr PByte Source # reprToHask :: PlutusRepr PByte -> Either LiftError (AsHaskell PByte) Source # reprToPlut :: forall (s :: S). PlutusRepr PByte -> PLifted s PByte Source # plutToRepr :: (forall (s :: S). PLifted s PByte) -> Either LiftError (PlutusRepr PByte) Source # | |||||||||
| POrd PByte Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source # (#<) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source # pmax :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PByte Source # pmin :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PByte Source # | |||||||||
| PlutusType PByte Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| Generic (PByte s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString Associated Types
| |||||||||
| Generic (PByte s) Source # | |||||||||
| type AsHaskell PByte Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr PByte Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner PByte Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type Rep (PByte s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Builtin.ByteString | |||||||||
| type Code (PByte s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString | |||||||||
data PByteString (s :: S) Source #
Plutus BuiltinByteString
Instances
| PEq PByteString Source # | |||||||||
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source # | |||||||||
| PIsData PByteString Source # | |||||||||
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData PByteString) -> Term s PByteString Source # pdataImpl :: forall (s :: S). Term s PByteString -> Term s PData Source # | |||||||||
| PLiftable PByteString Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PByteString -> PlutusRepr PByteString Source # reprToHask :: PlutusRepr PByteString -> Either LiftError (AsHaskell PByteString) Source # reprToPlut :: forall (s :: S). PlutusRepr PByteString -> PLifted s PByteString Source # plutToRepr :: (forall (s :: S). PLifted s PByteString) -> Either LiftError (PlutusRepr PByteString) Source # | |||||||||
| POrd PByteString Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source # (#<) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source # pmax :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source # pmin :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source # | |||||||||
| PValidateData PByteString Source # | Checks that we have a Since: 1.12.0 | ||||||||
| PlutusType PByteString Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PByteString s -> Term s (PInner PByteString) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PByteString) -> (PByteString s -> Term s b) -> Term s b Source # | |||||||||
| PMonoid PByteString Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| PSemigroup PByteString Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source # pstimes :: forall (s :: S). Term s PPositive -> Term s PByteString -> Term s PByteString Source # | |||||||||
| PShow PByteString Source # | |||||||||
Defined in Plutarch.Internal.Show | |||||||||
| PTryFrom PData (PAsData PByteString) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| Generic (PByteString s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString Associated Types
Methods from :: PByteString s -> Rep (PByteString s) x Source # to :: Rep (PByteString s) x -> PByteString s Source # | |||||||||
| Generic (PByteString s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString Associated Types
| |||||||||
| PMonoid (PAnd PByteString) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| PMonoid (POr PByteString) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| PMonoid (PXor PByteString) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| PSemigroup (PAnd PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (PAnd PByteString) -> Term s (PAnd PByteString) -> Term s (PAnd PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (PAnd PByteString) -> Term s (PAnd PByteString) Source # | |||||||||
| PSemigroup (POr PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (POr PByteString) -> Term s (POr PByteString) -> Term s (POr PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (POr PByteString) -> Term s (POr PByteString) Source # | |||||||||
| PSemigroup (PXor PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (PXor PByteString) -> Term s (PXor PByteString) -> Term s (PXor PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (PXor PByteString) -> Term s (PXor PByteString) Source # | |||||||||
| Monoid (Term s PByteString) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString Methods mempty :: Term s PByteString Source # mappend :: Term s PByteString -> Term s PByteString -> Term s PByteString Source # mconcat :: [Term s PByteString] -> Term s PByteString Source # | |||||||||
| Semigroup (Term s PByteString) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString Methods (<>) :: Term s PByteString -> Term s PByteString -> Term s PByteString Source # sconcat :: NonEmpty (Term s PByteString) -> Term s PByteString Source # stimes :: Integral b => b -> Term s PByteString -> Term s PByteString Source # | |||||||||
| type AsHaskell PByteString Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr PByteString Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner PByteString Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type PTryFromExcess PData (PAsData PByteString) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type Rep (PByteString s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString type Rep (PByteString s) = D1 ('MetaData "PByteString" "Plutarch.Builtin.ByteString" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "PByteString" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s POpaque)))) | |||||||||
| type Code (PByteString s) Source # | |||||||||
Defined in Plutarch.Builtin.ByteString | |||||||||
data PLogicOpSemantics (s :: S) Source #
Type designating whether logical operations should use padding or truncation semantics. See CIP-122 for more details on this.
Since: 1.10.0
Instances
| PEq PLogicOpSemantics Source # | |||||
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # | |||||
| POrd PLogicOpSemantics Source # | |||||
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # (#<) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # pmax :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PLogicOpSemantics Source # pmin :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PLogicOpSemantics Source # | |||||
| PlutusType PLogicOpSemantics Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PLogicOpSemantics s -> Term s (PInner PLogicOpSemantics) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PLogicOpSemantics) -> (PLogicOpSemantics s -> Term s b) -> Term s b Source # | |||||
| Generic (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString Associated Types
Methods from :: PLogicOpSemantics s -> Rep (PLogicOpSemantics s) x Source # to :: Rep (PLogicOpSemantics s) x -> PLogicOpSemantics s Source # | |||||
| Generic (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString Associated Types
Methods from :: PLogicOpSemantics s -> Rep (PLogicOpSemantics s) to :: Rep (PLogicOpSemantics s) -> PLogicOpSemantics s | |||||
| type PInner PLogicOpSemantics Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.PlutusType | |||||
| type Rep (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString type Rep (PLogicOpSemantics s) = D1 ('MetaData "PLogicOpSemantics" "Plutarch.Builtin.ByteString" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "PLogicOpSemantics" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PBool)))) | |||||
| type Code (PLogicOpSemantics s) Source # | |||||
Defined in Plutarch.Builtin.ByteString | |||||
pandBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString))) Source #
Perform the logical AND of two PByteStrings, as per
CIP-122.
The PLogicOpSemantics argument specifies what should be done if the lengths
of the two PByteString arguments do not match.
Since: 1.10.0
pcomplementBS :: forall (s :: S). Term s (PByteString :--> PByteString) Source #
Perform the logical complement of a PByteString, as per
CIP-122.
Since: 1.10.0
pconsBS :: forall (s :: S). Term s (PByte :--> (PByteString :--> PByteString)) Source #
Prepend a PByte to a 'PByteString.
Since: 1.10.0
phexByteStr :: forall (s :: S). HasCallStack => String -> Term s PByteString Source #
Interpret a hex string as a PByteString.
pindexBS :: forall (s :: S). Term s (PByteString :--> (PInteger :--> PByte)) Source #
Given a valid index into a PByteString, returns the PByte at that
index. Will crash if given an out-of-bounds index.
Since: 1.10.0
plengthBS :: forall (s :: S). Term s (PByteString :--> PInteger) Source #
Find the length of a PByteString.
porBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString))) Source #
Perform the logical OR of two PByteStrings, as per
CIP-122.
The PLogicOpSemantics argument specifies what should be done if the lengths
of the two PByteString arguments do not match.
Since: 1.10.0
ppadding :: forall (s :: S). Term s PLogicOpSemantics Source #
Indicates that padding semantics should be used.
Since: 1.10.0
preplicateBS :: forall (s :: S). Term s (PInteger :--> (PByte :--> PByteString)) Source #
Given a desired length and a PByte, construct a PByteString of the
specified length (0 if negative) consisting entirely of that PByte.
Since: 1.10.0
psliceBS :: forall (s :: S). Term s (PInteger :--> (PInteger :--> (PByteString :--> PByteString))) Source #
Slice a PByteString with given start index and slice length.
>>>(pslice # 2 # 3 phexByteStr "4102afde5b2a") #== phexByteStr "afde5b"
ptruncation :: forall (s :: S). Term s PLogicOpSemantics Source #
Indicates that truncation semantics should be used.
Since: 1.10.0
pxorBS :: forall (s :: S). Term s (PLogicOpSemantics :--> (PByteString :--> (PByteString :--> PByteString))) Source #
Perform the logical XOR of two PByteStrings, as per
CIP-122.
The PLogicOpSemantics argument specifies what should be done if the lengths
of the two PByteString arguments do not match.
Since: 1.10.0
Cryptographic primitives
psha2_256 :: forall (s :: S). Term s (PByteString :--> PByteString) Source #
Hash a PByteString using SHA-256.
psha3_256 :: forall (s :: S). Term s (PByteString :--> PByteString) Source #
Hash a PByteString using SHA3-256.
Data encoding
newtype PAsData (a :: S -> Type) (s :: S) Source #
Instances
| PFromDataable a (PAsData a) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal.FromData | |||||||||
| PTryFrom PData (PAsData PBool) Source # | Since: 1.7.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PByteString) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| (PTryFrom PData (PAsData a), PIsData a) => PTryFrom PData (PAsData (PBuiltinList (PAsData a))) Source # | Recover a `PBuiltinList (PAsData a)` | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData (PBuiltinList PData)) Source # | This verifies a list to be indeed a list but doesn't recover the inner data use this instance instead of the one for `PData (PAsData (PBuiltinList (PAsData a)))` as this is O(1) instead of O(n) | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| (PTryFrom PData a, a ~ PAsData a', PIsData a', PTryFrom PData b, b ~ PAsData b', PIsData b') => PTryFrom PData (PAsData (PBuiltinPair a b)) Source # | Recover a `PAsData (PBuiltinPair a b)` | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PData) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PInteger) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| (PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom PData (PAsData (PDataRecord as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||||||
| PTryFrom PData (PDataSum ys) => PTryFrom PData (PAsData (PDataSum ys)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||||||
| (PTryFrom PData a, PTryFrom PData b) => PTryFrom PData (PAsData (PEitherData a b)) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either Associated Types
| |||||||||
| PTryFrom PData (PAsData PNatural) Source # | Since: 3.4.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PPositive) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PRational) Source # | NOTE: This instance produces a verified | ||||||||
Defined in Plutarch.Rational Associated Types
| |||||||||
| (PIsData a, PDataFields a) => PDataFields (PAsData a) Source # | |||||||||
| PEq (PAsData a) Source # | |||||||||
| (ToData (AsHaskell a), FromData (AsHaskell a), PIsData a) => PLiftable (PAsData a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PAsData a) -> PlutusRepr (PAsData a) Source # reprToHask :: PlutusRepr (PAsData a) -> Either LiftError (AsHaskell (PAsData a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PAsData a) -> PLifted s (PAsData a) Source # plutToRepr :: (forall (s :: S). PLifted s (PAsData a)) -> Either LiftError (PlutusRepr (PAsData a)) Source # | |||||||||
| PValidateData a => PValidateData (PAsData a) Source # | Since: 1.12.0 | ||||||||
| (PValidateData a, PValidateData b) => PValidateData (PBuiltinList (PBuiltinPair (PAsData a) (PAsData b))) Source # | Checks that we have a Since: 1.13.0 | ||||||||
| PIsData a => PlutusType (PAsData a) Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| (PIsData a, PShow a) => PShow (PAsData a) Source # | |||||||||
| PIsData (PBuiltinPair (PAsData a) (PAsData b)) Source # | |||||||||
Defined in Plutarch.Internal.IsData | |||||||||
| (PValidateData a, PValidateData b) => PValidateData (PBuiltinPair (PAsData a) (PAsData b)) Source # | Checks that we have a Since: 1.12.0 | ||||||||
| type PTryFromExcess PData (PAsData PBool) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PByteString) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinList (PAsData a))) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom type PTryFromExcess PData (PAsData (PBuiltinList (PAsData a))) = Flip Term (PBuiltinList (PAsData a)) | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinList PData)) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinPair a b)) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PData) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PInteger) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData (PDataRecord as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type PTryFromExcess PData (PAsData (PDataSum ys)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type PTryFromExcess PData (PAsData (PEitherData a b)) Source # | |||||||||
Defined in Plutarch.Either type PTryFromExcess PData (PAsData (PEitherData a b)) = PTryFromExcess PData (PInner (PAsData (PEitherData a b))) | |||||||||
| type PTryFromExcess PData (PAsData PNatural) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PPositive) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PRational) Source # | |||||||||
Defined in Plutarch.Rational | |||||||||
| type PFields (PAsData a) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal.Field | |||||||||
| type AsHaskell (PAsData a) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr (PAsData a) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner (PAsData a) Source # | |||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
data PBuiltinList (a :: S -> Type) (s :: S) Source #
Plutus BuiltinList
Constructors
| PCons (Term s a) (Term s (PBuiltinList a)) | |
| PNil |
Instances
| PListLike PBuiltinList Source # | |||||||||
Defined in Plutarch.Internal.ListLike Associated Types
Methods pelimList :: forall (a :: S -> Type) (s :: S) (r :: S -> Type). PElemConstraint PBuiltinList a => (Term s a -> Term s (PBuiltinList a) -> Term s r) -> Term s r -> Term s (PBuiltinList a) -> Term s r Source # pcons :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (a :--> (PBuiltinList a :--> PBuiltinList a)) Source # pnil :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a) Source # phead :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a :--> a) Source # ptail :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a :--> PBuiltinList a) Source # pnull :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a :--> PBool) Source # | |||||||||
| (PTryFrom PData (PAsData a), PIsData a) => PTryFrom PData (PAsData (PBuiltinList (PAsData a))) Source # | Recover a `PBuiltinList (PAsData a)` | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData (PBuiltinList PData)) Source # | This verifies a list to be indeed a list but doesn't recover the inner data use this instance instead of the one for `PData (PAsData (PBuiltinList (PAsData a)))` as this is O(1) instead of O(n) | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| Fc (F a) a => PEq (PBuiltinList a) Source # | |||||||||
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s (PBuiltinList a) -> Term s (PBuiltinList a) -> Term s PBool Source # | |||||||||
| (PInnermostIsData ('Just "PBuiltinList only implements PIsData when inner most type of its elements are PData") a, PSubtype PData a) => PIsData (PBuiltinList a) Source # | |||||||||
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PBuiltinList a)) -> Term s (PBuiltinList a) Source # pdataImpl :: forall (s :: S). Term s (PBuiltinList a) -> Term s PData Source # | |||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PBuiltinList a) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PBuiltinList a) -> PlutusRepr (PBuiltinList a) Source # reprToHask :: PlutusRepr (PBuiltinList a) -> Either LiftError (AsHaskell (PBuiltinList a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PBuiltinList a) -> PLifted s (PBuiltinList a) Source # plutToRepr :: (forall (s :: S). PLifted s (PBuiltinList a)) -> Either LiftError (PlutusRepr (PBuiltinList a)) Source # | |||||||||
| (PValidateData a, PValidateData b) => PValidateData (PBuiltinList (PBuiltinPair (PAsData a) (PAsData b))) Source # | Checks that we have a Since: 1.13.0 | ||||||||
| PValidateData (PBuiltinList PData) Source # | Checks that we have a Since: 1.12.0 | ||||||||
| PValidateData a => PValidateData (PBuiltinList a) Source # | Checks that we have a Since: 1.12.0 | ||||||||
| Contains DefaultUni (PlutusRepr a) => PlutusType (PBuiltinList a) Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PBuiltinList a s -> Term s (PInner (PBuiltinList a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PBuiltinList a)) -> (PBuiltinList a s -> Term s b) -> Term s b Source # | |||||||||
| (PShow a, Contains DefaultUni (PlutusRepr a)) => PShow (PBuiltinList a) Source # | |||||||||
Defined in Plutarch.Internal.Show | |||||||||
| (Helper2 (PSubtype' PData pty) pty, PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ((name ':= pty) ': as)), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) s)) -> Term s r) -> Term s r Source # | |||||||||
| PTryFrom (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ('[] :: [PLabeledType])), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) s)) -> Term s r) -> Term s r Source # | |||||||||
| PIsData (PBuiltinPair PInteger (PBuiltinList PData)) Source # | |||||||||
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PBuiltinPair PInteger (PBuiltinList PData))) -> Term s (PBuiltinPair PInteger (PBuiltinList PData)) Source # pdataImpl :: forall (s :: S). Term s (PBuiltinPair PInteger (PBuiltinList PData)) -> Term s PData Source # | |||||||||
| type PElemConstraint PBuiltinList a Source # | |||||||||
Defined in Plutarch.Internal.ListLike | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinList (PAsData a))) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom type PTryFromExcess PData (PAsData (PBuiltinList (PAsData a))) = Flip Term (PBuiltinList (PAsData a)) | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinList PData)) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type AsHaskell (PBuiltinList a) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr (PBuiltinList a) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner (PBuiltinList a) Source # | |||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
data PBuiltinPair (a :: S -> Type) (b :: S -> Type) (s :: S) Source #
A builtin Plutus pair.
Since: 1.12.0
Constructors
| PBuiltinPair (Term s a) (Term s b) |
Instances
| (PTryFrom PData a, a ~ PAsData a', PIsData a', PTryFrom PData b, b ~ PAsData b', PIsData b') => PTryFrom PData (PAsData (PBuiltinPair a b)) Source # | Recover a `PAsData (PBuiltinPair a b)` | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| (PValidateData a, PValidateData b) => PValidateData (PBuiltinList (PBuiltinPair (PAsData a) (PAsData b))) Source # | Checks that we have a Since: 1.13.0 | ||||||||
| (PEq a, PEq b) => PEq (PBuiltinPair a b) Source # | |||||||||
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s (PBuiltinPair a b) -> Term s (PBuiltinPair a b) -> Term s PBool Source # | |||||||||
| PIsData (PBuiltinPair (PAsData a) (PAsData b)) Source # | |||||||||
Defined in Plutarch.Internal.IsData | |||||||||
| PIsData (PBuiltinPair PData PData) Source # | |||||||||
Defined in Plutarch.Internal.IsData | |||||||||
| PIsData (PBuiltinPair PInteger (PBuiltinList PData)) Source # | |||||||||
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PBuiltinPair PInteger (PBuiltinList PData))) -> Term s (PBuiltinPair PInteger (PBuiltinList PData)) Source # pdataImpl :: forall (s :: S). Term s (PBuiltinPair PInteger (PBuiltinList PData)) -> Term s PData Source # | |||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a), PLiftable b, Includes DefaultUni (PlutusRepr b), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr b)) => PLiftable (PBuiltinPair a b) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PBuiltinPair a b) -> PlutusRepr (PBuiltinPair a b) Source # reprToHask :: PlutusRepr (PBuiltinPair a b) -> Either LiftError (AsHaskell (PBuiltinPair a b)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PBuiltinPair a b) -> PLifted s (PBuiltinPair a b) Source # plutToRepr :: (forall (s :: S). PLifted s (PBuiltinPair a b)) -> Either LiftError (PlutusRepr (PBuiltinPair a b)) Source # | |||||||||
| (PValidateData a, PValidateData b) => PValidateData (PBuiltinPair (PAsData a) (PAsData b)) Source # | Checks that we have a Since: 1.12.0 | ||||||||
| PValidateData (PBuiltinPair PData PData) Source # | Checks that we have a Since: 1.12.0 | ||||||||
| PlutusType (PBuiltinPair a b) Source # | Important noteDue to some weirdnesses regarding builtins, Since: 1.12.0 | ||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PBuiltinPair a b s -> Term s (PInner (PBuiltinPair a b)) Source # pmatch' :: forall (s :: S) (b0 :: S -> Type). Term s (PInner (PBuiltinPair a b)) -> (PBuiltinPair a b s -> Term s b0) -> Term s b0 Source # | |||||||||
| (PShow a, PShow b) => PShow (PBuiltinPair a b) Source # | |||||||||
Defined in Plutarch.Internal.Show | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinPair a b)) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type AsHaskell (PBuiltinPair a b) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr (PBuiltinPair a b) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner (PBuiltinPair a b) Source # | |||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
newtype PData (s :: S) Source #
Instances
| PEq PData Source # | |||||||||
| PIsData PData Source # | |||||||||
| PLiftable PData Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PData -> PlutusRepr PData Source # reprToHask :: PlutusRepr PData -> Either LiftError (AsHaskell PData) Source # reprToPlut :: forall (s :: S). PlutusRepr PData -> PLifted s PData Source # plutToRepr :: (forall (s :: S). PLifted s PData) -> Either LiftError (PlutusRepr PData) Source # | |||||||||
| PValidateData PData Source # | Checks (and does) nothing. Since: 1.12.0 | ||||||||
| PlutusType PData Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| PShow PData Source # | |||||||||
| PTryFrom PData PData Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PBool) Source # | Since: 1.7.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PByteString) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| (PTryFrom PData (PAsData a), PIsData a) => PTryFrom PData (PAsData (PBuiltinList (PAsData a))) Source # | Recover a `PBuiltinList (PAsData a)` | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData (PBuiltinList PData)) Source # | This verifies a list to be indeed a list but doesn't recover the inner data use this instance instead of the one for `PData (PAsData (PBuiltinList (PAsData a)))` as this is O(1) instead of O(n) | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| (PTryFrom PData a, a ~ PAsData a', PIsData a', PTryFrom PData b, b ~ PAsData b', PIsData b') => PTryFrom PData (PAsData (PBuiltinPair a b)) Source # | Recover a `PAsData (PBuiltinPair a b)` | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PData) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PInteger) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| (PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom PData (PAsData (PDataRecord as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||||||
| PTryFrom PData (PDataSum ys) => PTryFrom PData (PAsData (PDataSum ys)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||||||
| (PTryFrom PData a, PTryFrom PData b) => PTryFrom PData (PAsData (PEitherData a b)) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either Associated Types
| |||||||||
| PTryFrom PData (PAsData PNatural) Source # | Since: 3.4.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PPositive) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PRational) Source # | NOTE: This instance produces a verified | ||||||||
Defined in Plutarch.Rational Associated Types
| |||||||||
| SumValidation 0 ys => PTryFrom PData (PDataSum ys) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||||||
| (PTryFrom PData a, PTryFrom PData b) => PTryFrom PData (PEitherData a b) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either Associated Types
| |||||||||
| PValidateData (PBuiltinList PData) Source # | Checks that we have a Since: 1.12.0 | ||||||||
| (Helper2 (PSubtype' PData pty) pty, PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ((name ':= pty) ': as)), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) s)) -> Term s r) -> Term s r Source # | |||||||||
| PTryFrom (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ('[] :: [PLabeledType])), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) s)) -> Term s r) -> Term s r Source # | |||||||||
| PIsData (PBuiltinPair PData PData) Source # | |||||||||
Defined in Plutarch.Internal.IsData | |||||||||
| PIsData (PBuiltinPair PInteger (PBuiltinList PData)) Source # | |||||||||
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PBuiltinPair PInteger (PBuiltinList PData))) -> Term s (PBuiltinPair PInteger (PBuiltinList PData)) Source # pdataImpl :: forall (s :: S). Term s (PBuiltinPair PInteger (PBuiltinList PData)) -> Term s PData Source # | |||||||||
| PValidateData (PBuiltinPair PData PData) Source # | Checks that we have a Since: 1.12.0 | ||||||||
| type AsHaskell PData Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr PData Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner PData Source # | |||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type PTryFromExcess PData PData Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PBool) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PByteString) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinList (PAsData a))) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom type PTryFromExcess PData (PAsData (PBuiltinList (PAsData a))) = Flip Term (PBuiltinList (PAsData a)) | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinList PData)) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData (PBuiltinPair a b)) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PData) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PInteger) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData (PDataRecord as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type PTryFromExcess PData (PAsData (PDataSum ys)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type PTryFromExcess PData (PAsData (PEitherData a b)) Source # | |||||||||
Defined in Plutarch.Either type PTryFromExcess PData (PAsData (PEitherData a b)) = PTryFromExcess PData (PInner (PAsData (PEitherData a b))) | |||||||||
| type PTryFromExcess PData (PAsData PNatural) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PPositive) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PRational) Source # | |||||||||
Defined in Plutarch.Rational | |||||||||
| type PTryFromExcess PData (PDataSum ys) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type PTryFromExcess PData (PEitherData a b) Source # | |||||||||
Defined in Plutarch.Either | |||||||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
pasByteStr :: forall (s :: S). Term s (PData :--> PByteString) Source #
pasConstr :: forall (s :: S). Term s (PData :--> PBuiltinPair PInteger (PBuiltinList PData)) Source #
pchooseData :: forall (s :: S) (a :: S -> Type). Term s (PData :--> (a :--> (a :--> (a :--> (a :--> (a :--> a)))))) Source #
pchooseListBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PBuiltinList a :--> (b :--> (b :--> b))) Source #
pconsBuiltin :: forall (s :: S) (a :: S -> Type). Term s (a :--> (PBuiltinList a :--> PBuiltinList a)) Source #
pconstrBuiltin :: forall (s :: S). Term s (PInteger :--> (PBuiltinList PData :--> PAsData (PBuiltinPair PInteger (PBuiltinList PData)))) Source #
pfstBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PBuiltinPair a b :--> a) Source #
Deprecated: Use pmatch instead
pheadBuiltin :: forall (s :: S) (a :: S -> Type). Term s (PBuiltinList a :--> a) Source #
pnullBuiltin :: forall (s :: S) (a :: S -> Type). Term s (PBuiltinList a :--> PBool) Source #
ppairDataBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PAsData a :--> (PAsData b :--> PBuiltinPair (PAsData a) (PAsData b))) Source #
pserialiseData :: forall (s :: S). Term s (PData :--> PByteString) Source #
Serialise any builtin data to its cbor represented by a builtin bytestring
psndBuiltin :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (PBuiltinPair a b :--> b) Source #
Deprecated: Use pmatch instead
ptailBuiltin :: forall (s :: S) (a :: S -> Type). Term s (PBuiltinList a :--> PBuiltinList a) Source #
pheadTailBuiltin :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Term s (PBuiltinList a) -> (Term s a -> Term s (PBuiltinList a) -> Term s b) -> Term s b Source #
Use this in preference to pheadBuiltin and ptailBuiltin on the same
PBuiltinList, as this will be faster. This is also faster than a pmatch,
as the PNil case is omitted.
Since: 1.13.0
Integer
data PInteger (s :: S) Source #
A builtin Plutus integer.
Since: 1.10.0
Instances
| PCountable PInteger Source # | Since: 1.10.0 | ||||||||
| PEnumerable PInteger Source # | Since: 1.10.0 | ||||||||
| PEq PInteger Source # | Since: 1.10.0 | ||||||||
| PIsData PInteger Source # | |||||||||
| PLiftable PInteger Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PInteger -> PlutusRepr PInteger Source # reprToHask :: PlutusRepr PInteger -> Either LiftError (AsHaskell PInteger) Source # reprToPlut :: forall (s :: S). PlutusRepr PInteger -> PLifted s PInteger Source # plutToRepr :: (forall (s :: S). PLifted s PInteger) -> Either LiftError (PlutusRepr PInteger) Source # | |||||||||
| PAdditiveGroup PInteger Source # | Since: 1.10.0 | ||||||||
| PAdditiveMonoid PInteger Source # | Since: 1.10.0 | ||||||||
| PAdditiveSemigroup PInteger Source # | Since: 1.10.0 | ||||||||
| PIntegralDomain PInteger Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeMonoid PInteger Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeSemigroup PInteger Source # | Since: 1.10.0 | ||||||||
| PRing PInteger Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| POrd PInteger Source # | |||||||||
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source # (#<) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source # pmax :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PInteger Source # pmin :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PInteger Source # | |||||||||
| PValidateData PInteger Source # | Checks that we have an Since: 1.12.0 | ||||||||
| PlutusType PInteger Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| PShow PInteger Source # | |||||||||
| PTryFrom PInteger PPositive Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PInteger) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| Generic (PInteger s) Source # | |||||||||
Defined in Plutarch.Builtin.Integer Associated Types
| |||||||||
| Generic (PInteger s) Source # | |||||||||
| PIsData (PBuiltinPair PInteger (PBuiltinList PData)) Source # | |||||||||
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PBuiltinPair PInteger (PBuiltinList PData))) -> Term s (PBuiltinPair PInteger (PBuiltinList PData)) Source # pdataImpl :: forall (s :: S). Term s (PBuiltinPair PInteger (PBuiltinList PData)) -> Term s PData Source # | |||||||||
| type AsHaskell PInteger Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr PInteger Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner PInteger Source # | |||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type PTryFromExcess PInteger PPositive Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PInteger) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type Rep (PInteger s) Source # | |||||||||
Defined in Plutarch.Builtin.Integer | |||||||||
| type Code (PInteger s) Source # | |||||||||
Defined in Plutarch.Builtin.Integer | |||||||||
Opaque
newtype POpaque (s :: S) Source #
An Arbitrary Term with an unknown type
Instances
| PlutusType POpaque Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| type PInner POpaque Source # | |||||
Defined in Plutarch.Internal.PlutusType | |||||
popaque :: forall (s :: S) (a :: S -> Type). Term s a -> Term s POpaque Source #
Erase the type of a Term
String
data PString (s :: S) Source #
Plutus BuiltinString values
Instances
| PEq PString Source # | |||||||||
| PLiftable PString Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PString -> PlutusRepr PString Source # reprToHask :: PlutusRepr PString -> Either LiftError (AsHaskell PString) Source # reprToPlut :: forall (s :: S). PlutusRepr PString -> PLifted s PString Source # plutToRepr :: (forall (s :: S). PLifted s PString) -> Either LiftError (PlutusRepr PString) Source # | |||||||||
| PlutusType PString Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| PMonoid PString Source # | Since: 1.10.0 | ||||||||
| PSemigroup PString Source # | Since: 1.10.0 | ||||||||
| PShow PString Source # | |||||||||
| Generic (PString s) Source # | |||||||||
Defined in Plutarch.Builtin.String Associated Types
| |||||||||
| Generic (PString s) Source # | |||||||||
| IsString (Term s PString) Source # | |||||||||
Defined in Plutarch.Builtin.String | |||||||||
| Monoid (Term s PString) Source # | |||||||||
| Semigroup (Term s PString) Source # | |||||||||
| type AsHaskell PString Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr PString Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner PString Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type Rep (PString s) Source # | |||||||||
Defined in Plutarch.Builtin.String | |||||||||
| type Code (PString s) Source # | |||||||||
Defined in Plutarch.Builtin.String | |||||||||
pdecodeUtf8 :: forall (s :: S). Term s (PByteString :--> PString) Source #
Decode a PByteString using UTF-8.
pencodeUtf8 :: forall (s :: S). Term s (PString :--> PByteString) Source #
Encode a PString using UTF-8.
Unit
Constructors
| PUnit |
Instances
| PEq PUnit Source # | |||||||||
| PIsData PUnit Source # | |||||||||
| PLiftable PUnit Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PUnit -> PlutusRepr PUnit Source # reprToHask :: PlutusRepr PUnit -> Either LiftError (AsHaskell PUnit) Source # reprToPlut :: forall (s :: S). PlutusRepr PUnit -> PLifted s PUnit Source # plutToRepr :: (forall (s :: S). PLifted s PUnit) -> Either LiftError (PlutusRepr PUnit) Source # | |||||||||
| POrd PUnit Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source # (#<) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source # pmax :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PUnit Source # pmin :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PUnit Source # | |||||||||
| PlutusType PUnit Source # | |||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| PMonoid PUnit Source # | Since: 1.10.0 | ||||||||
| PSemigroup PUnit Source # | Since: 1.10.0 | ||||||||
| PShow PUnit Source # | |||||||||
| Monoid (Term s PUnit) Source # | |||||||||
| Semigroup (Term s PUnit) Source # | |||||||||
| type AsHaskell PUnit Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr PUnit Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner PUnit Source # | |||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
DataRepr
class PDataFields (a :: S -> Type) Source #
Class allowing letFields to work for a Plutarch type (`S -> Type`), usually via
PIsDataRepr, but is derived for some other types for convenience.
Instances
| (PIsData a, PDataFields a) => PDataFields (PAsData a) Source # | |||||
| PDataFields (PDataRecord as) Source # | |||||
Defined in Plutarch.DataRepr.Internal.Field Associated Types
Methods ptoFields :: forall (s :: S). Term s (PDataRecord as) -> Term s (PDataRecord (PFields (PDataRecord as))) Source # | |||||
| PDataFields (PDataSum '[as]) Source # | |||||
data PDataRecord (as :: [PLabeledType]) (s :: S) Source #
A "record" of `exists a. PAsData a`. The underlying representation is `PBuiltinList PData`.
Instances
| (PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom PData (PAsData (PDataRecord as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| PDataFields (PDataRecord as) Source # | |||||
Defined in Plutarch.DataRepr.Internal.Field Associated Types
Methods ptoFields :: forall (s :: S). Term s (PDataRecord as) -> Term s (PDataRecord (PFields (PDataRecord as))) Source # | |||||
| PEq (PDataRecord xs) Source # | This uses data equality. | ||||
Defined in Plutarch.DataRepr.Internal Methods (#==) :: forall (s :: S). Term s (PDataRecord xs) -> Term s (PDataRecord xs) -> Term s PBool Source # | |||||
| PIsData (PDataRecord xs) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PDataRecord xs)) -> Term s (PDataRecord xs) Source # pdataImpl :: forall (s :: S). Term s (PDataRecord xs) -> Term s PData Source # | |||||
| (SListI xs, POrd x, PIsData x, POrd (PDataRecord (x' ': xs))) => POrd (PDataRecord ((label ':= x) ': (x' ': xs))) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source # pmin :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source # | |||||
| (POrd x, PIsData x) => POrd (PDataRecord '[label ':= x]) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source # pmin :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source # | |||||
| POrd (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) Source # pmin :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
| SListI l => PlutusType (PDataRecord l) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods pcon' :: forall (s :: S). PDataRecord l s -> Term s (PInner (PDataRecord l)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PDataRecord l)) -> (PDataRecord l s -> Term s b) -> Term s b Source # | |||||
| (All (Top :: PLabeledType -> Constraint) xs, KnownSymbol label, PIsData x, PShow x, PShow (PDataRecordShowHelper xs)) => PShow (PDataRecord ((label ':= x) ': xs)) Source # | |||||
| PShow (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods pshow' :: forall (s :: S). Bool -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PString Source # | |||||
| (Helper2 (PSubtype' PData pty) pty, PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ((name ':= pty) ': as)), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) s)) -> Term s r) -> Term s r Source # | |||||
| PTryFrom (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ('[] :: [PLabeledType])), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) s)) -> Term s r) -> Term s r Source # | |||||
| type PTryFromExcess PData (PAsData (PDataRecord as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
| type PFields (PDataRecord as) Source # | |||||
Defined in Plutarch.DataRepr.Internal.Field | |||||
| type PInner (PDataRecord l) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
data PDataSum (defs :: [[PLabeledType]]) (s :: S) Source #
A sum of PDataRecords. The underlying representation is the Constr constructor,
where the integer is the index of the variant and the list is the record.
Instances
| PTryFrom PData (PDataSum ys) => PTryFrom PData (PAsData (PDataSum ys)) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| SumValidation 0 ys => PTryFrom PData (PDataSum ys) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| PDataFields (PDataSum '[as]) Source # | |||||
| PEq (PDataSum defs) Source # | |||||
| PIsData (PDataSum defs) Source # | |||||
| All (Compose POrd PDataRecord) defs => POrd (PDataSum defs) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s (PDataSum defs) Source # pmin :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s (PDataSum defs) Source # | |||||
| SListI defs => PlutusType (PDataSum defs) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| (All (Top :: [PLabeledType] -> Constraint) defs, All (Compose PShow PDataRecord) defs) => PShow (PDataSum defs) Source # | |||||
| type PTryFromExcess PData (PAsData (PDataSum ys)) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
| type PTryFromExcess PData (PDataSum ys) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
| type PFields (PDataSum '[as]) Source # | |||||
Defined in Plutarch.DataRepr.Internal.Field | |||||
| type PInner (PDataSum defs) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
data PLabeledType Source #
Instances
| PDataFields (PDataSum '[as]) Source # | |||||
| (SListI xs, POrd x, PIsData x, POrd (PDataRecord (x' ': xs))) => POrd (PDataRecord ((label ':= x) ': (x' ': xs))) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source # pmin :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source # | |||||
| (POrd x, PIsData x) => POrd (PDataRecord '[label ':= x]) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source # pmin :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source # | |||||
| POrd (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) Source # pmin :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
| (All (Top :: PLabeledType -> Constraint) xs, KnownSymbol label, PIsData x, PShow x, PShow (PDataRecordShowHelper xs)) => PShow (PDataRecord ((label ':= x) ': xs)) Source # | |||||
| PShow (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal Methods pshow' :: forall (s :: S). Bool -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PString Source # | |||||
| (Helper2 (PSubtype' PData pty) pty, PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ((name ':= pty) ': as)), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) s)) -> Term s r) -> Term s r Source # | |||||
| PTryFrom (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ('[] :: [PLabeledType])), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) s)) -> Term s r) -> Term s r Source # | |||||
| type PFields (PDataSum '[as]) Source # | |||||
Defined in Plutarch.DataRepr.Internal.Field | |||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
| type PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal | |||||
data PlutusTypeData Source #
Instances
| PlutusTypeStrat PlutusTypeData Source # | |||||||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods derivedPCon :: forall a (s :: S). (DerivePlutusType a, DPTStrat a ~ PlutusTypeData) => a s -> Term s (DerivedPInner PlutusTypeData a) Source # derivedPMatch :: forall a (s :: S) (b :: S -> Type). (DerivePlutusType a, DPTStrat a ~ PlutusTypeData) => Term s (DerivedPInner PlutusTypeData a) -> (a s -> Term s b) -> Term s b Source # | |||||||||
| type PlutusTypeStratConstraint PlutusTypeData Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
| type DerivedPInner PlutusTypeData a Source # | |||||||||
Defined in Plutarch.DataRepr.Internal | |||||||||
pdcons :: forall (label :: Symbol) (a :: S -> Type) (l :: [PLabeledType]) (s :: S). Term s (PAsData a :--> (PDataRecord l :--> PDataRecord ((label ':= a) ': l))) Source #
Cons a field to a data record.
You can specify the label to associate with the field using type applications-
foo :: Term s (PDataRecord '[ "fooField" ':= PByteString ]) foo = pdcons @"fooField" # pdata (phexByteStr "ab") # pdnil
pdnil :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) Source #
An empty PDataRecord.
pfield :: forall (name :: Symbol) (b :: S -> Type) (p :: S -> Type) (s :: S) (a :: S -> Type) (as :: [PLabeledType]) (n :: Nat). (PDataFields p, as ~ PFields p, n ~ PLabelIndex name as, KnownNat n, a ~ PUnLabel (IndexList n as), PFromDataable a b) => Term s (p :--> b) Source #
Get a single field from a Term.
- NB*: If you access more than one field from
the same value you should use
pletFieldsinstead, which will generate the bindings more efficiently.
pletFields :: forall (fs :: [Symbol]) (a :: S -> Type) (s :: S) (b :: S -> Type) (ps :: [PLabeledType]) (bs :: [ToBind]). (PDataFields a, ps ~ PFields a, bs ~ Bindings ps fs, BindFields ps bs) => Term s a -> (HRecOf a fs s -> Term s b) -> Term s b Source #
Bind a HRec of named fields containing all the specified fields.
Either
data PEither (a :: S -> Type) (b :: S -> Type) (s :: S) Source #
SOP-encoded Either.
Since: 1.10.0
Instances
| (PEq a, PEq b) => PEq (PEither a b) Source # | Since: 1.10.0 | ||||||||
| (PLiftable a, PLiftable b) => PLiftable (PEither a b) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either Associated Types
Methods haskToRepr :: AsHaskell (PEither a b) -> PlutusRepr (PEither a b) Source # reprToHask :: PlutusRepr (PEither a b) -> Either LiftError (AsHaskell (PEither a b)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PEither a b) -> PLifted s (PEither a b) Source # plutToRepr :: (forall (s :: S). PLifted s (PEither a b)) -> Either LiftError (PlutusRepr (PEither a b)) Source # | |||||||||
| PlutusType (PEither a b) Source # | |||||||||
Defined in Plutarch.Either Associated Types
| |||||||||
| (PShow a, PShow b) => PShow (PEither a b) Source # | Since: 1.10.0 | ||||||||
| Generic (PEither a b s) Source # | |||||||||
Defined in Plutarch.Either Associated Types
| |||||||||
| Generic (PEither a b s) Source # | |||||||||
| type AsHaskell (PEither a b) Source # | |||||||||
| type PlutusRepr (PEither a b) Source # | |||||||||
Defined in Plutarch.Either | |||||||||
| type PInner (PEither a b) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either | |||||||||
| type Rep (PEither a b s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either type Rep (PEither a b s) = D1 ('MetaData "PEither" "Plutarch.Either" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'False) (C1 ('MetaCons "PLeft" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a))) :+: C1 ('MetaCons "PRight" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s b)))) | |||||||||
| type Code (PEither a b s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either | |||||||||
Enumerable and Countable
class POrd a => PCountable (a :: S -> Type) where Source #
A notion of 'next' value. More formally, instances of this type class are discrete linear orders with no maximal element.
Laws
x /= psuccessor x
y < x=psuccessor y <= xx < psuccessor y=x <= y
If you define psuccessorN, you must also ensure the following hold; the
default implementation ensures this.
psuccessorN 1=psuccessorpsuccessorN n . psuccessorN m=psuccessorN (n + m)
Law 1 ensures no value is its own successor. Laws 2 and 3 ensure that there
are no 'gaps': every value is 'reachable' from any lower value by a
finite number of applications of successor.
Since: 1.10.0
Minimal complete definition
Methods
psuccessor :: forall (s :: S). Term s (a :--> a) Source #
Since: 1.10.0
psuccessorN :: forall (s :: S). Term s (PPositive :--> (a :--> a)) Source #
The default implementation of this function is inefficient: if at all possible, give instances an optimized version that doesn't require recursion.
Since: 1.10.0
Instances
| PCountable PInteger Source # | Since: 1.10.0 |
| PCountable PPositive Source # | Since: 1.10.0 |
class PCountable a => PEnumerable (a :: S -> Type) where Source #
Similar to PCountable, but has the ability to get a 'previous' value as
well. More formally, instances of this type class are discrete linear orders
with no maximal or minimal element.
Laws
ppredecessor . psuccessor=psuccessor . ppredecessor=id
If you define ppredecessorN, you must also ensure the following hold; the
default implementation ensures this.
ppredecessorN 1=ppredecessorppredecessorN n . ppredecessorN m=ppredecessorN (n + m)
From Law 1, we obtain the following theorem:
x /= predecessor x
Since: 1.10.0
Minimal complete definition
Methods
ppredecessor :: forall (s :: S). Term s (a :--> a) Source #
Since: 1.10.0
ppredecessorN :: forall (s :: S). Term s (PPositive :--> (a :--> a)) Source #
The default implementation of this function is inefficient: if at all possible, give instances an optimized version that doesn't require recursion.
Since: 1.10.0
Eq and Ord
class PEq (t :: S -> Type) where Source #
Minimal complete definition
Nothing
Instances
| PEq PBitString Source # | Since: 1.10.0 |
Defined in Plutarch.BitString Methods (#==) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBool Source # | |
| PEq PBuiltinBLS12_381_G1_Element Source # | |
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element -> Term s PBool Source # | |
| PEq PBuiltinBLS12_381_G2_Element Source # | |
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element -> Term s PBool Source # | |
| PEq PBool Source # | |
| PEq PByte Source # | Since: 1.10.0 |
| PEq PByteString Source # | |
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source # | |
| PEq PEndianness Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source # | |
| PEq PLogicOpSemantics Source # | |
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # | |
| PEq PData Source # | |
| PEq PInteger Source # | Since: 1.10.0 |
| PEq PString Source # | |
| PEq PUnit Source # | |
| PEq PNatural Source # | Since: 1.10.0 |
| PEq PPositive Source # | Since: 1.10.0 |
| PEq PRational Source # | |
| PEq (PAsData a) Source # | |
| Fc (F a) a => PEq (PBuiltinList a) Source # | |
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s (PBuiltinList a) -> Term s (PBuiltinList a) -> Term s PBool Source # | |
| PEq (PDataRecord xs) Source # | This uses data equality. |
Defined in Plutarch.DataRepr.Internal Methods (#==) :: forall (s :: S). Term s (PDataRecord xs) -> Term s (PDataRecord xs) -> Term s PBool Source # | |
| PEq (PDataSum defs) Source # | |
| PEq a => PEq (PAnd a) Source # | Since: 1.10.0 |
| PEq a => PEq (POr a) Source # | Since: 1.10.0 |
| PEq a => PEq (PXor a) Source # | Since: 1.10.0 |
| PEq a => PEq (PList a) Source # | |
| PEq a => PEq (PMaybe a) Source # | Since: 1.10.0 |
| PEq (PDataRec struct) Source # | Since: 1.10.0 |
| PEq (PDataStruct struct) Source # | Since: 1.10.0 |
Defined in Plutarch.Repr.Data Methods (#==) :: forall (s :: S). Term s (PDataStruct struct) -> Term s (PDataStruct struct) -> Term s PBool Source # | |
| All PEq struct => PEq (PSOPRec struct) Source # | Since: 1.10.0 |
| (PlutusType (PSOPStruct struct), All2 PEq struct) => PEq (PSOPStruct struct) Source # | |
Defined in Plutarch.Repr.SOP Methods (#==) :: forall (s :: S). Term s (PSOPStruct struct) -> Term s (PSOPStruct struct) -> Term s PBool Source # | |
| All PEq struct => PEq (PScottRec struct) Source # | Since: 1.10.0 |
| (PlutusType (PScottStruct struct), SListI2 struct, All2 PEq struct) => PEq (PScottStruct struct) Source # | Since: 1.10.0 |
Defined in Plutarch.Repr.Scott Methods (#==) :: forall (s :: S). Term s (PScottStruct struct) -> Term s (PScottStruct struct) -> Term s PBool Source # | |
| (PEq a, PEq b) => PEq (PBuiltinPair a b) Source # | |
Defined in Plutarch.Internal.Eq Methods (#==) :: forall (s :: S). Term s (PBuiltinPair a b) -> Term s (PBuiltinPair a b) -> Term s PBool Source # | |
| (PEq a, PEq b) => PEq (PEither a b) Source # | Since: 1.10.0 |
| PEq (PEitherData a b) Source # | Since: 1.10.0 |
Defined in Plutarch.Either Methods (#==) :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s PBool Source # | |
| (PEq a, PEq b) => PEq (PPair a b) Source # | Since: 1.10.0 |
class PEq t => POrd (t :: S -> Type) where Source #
Total ordering relation.
Laws
#<= must form a total order. More precisely:
x #<= x=pcon PTrue(reflexivity)(y #< x) #|| (z #< y) #|| (x #<= z)=pcon PTrue(transitivity)(x #<= y) #|| (y #<= x)=pcon PTrue(totality)
Furthermore, #< must be an equivalent strict total order to #<=:
x #< x=pcon PFalse(irreflexivity)(y #<= x) #|| (z #<= y) #|| (x #< z)=pcon PTrue(transitivity)(x #< y) #|| (y #< x) #|| (x #== z)=pcon PTrue(trichotomy)x #<= y=(x #< y) #|| (x #== y)(strict equivalence)
If you define pmax or pmin, ensure the following also hold:
pmax # x # y=pmax # y # x(commutativity, also for @pmin)pmax # x #$ pmax y z=pmax # (pmax # x # y) # z(associativity, also for @pmin)pmax # x #$ pmin # y # z=pmin # (pmax # x # y) # (pmax # x # z)(pmaxdistributes overpmin, also equivalent forpmin)pmin x y=pif' (x #<= y) x ypmax x y=pif' (x #<= y) y x
Laws 8-12 hold if you use the defaults provided by this type class.
Since: 1.10.0
Minimal complete definition
Nothing
Methods
(#<=) :: forall (s :: S). Term s t -> Term s t -> Term s PBool infix 4 Source #
Since: 1.10.0
(#<) :: forall (s :: S). Term s t -> Term s t -> Term s PBool infix 4 Source #
Since: 1.10.0
pmax :: forall (s :: S). Term s t -> Term s t -> Term s t Source #
Since: 1.10.0
pmin :: forall (s :: S). Term s t -> Term s t -> Term s t Source #
Since: 1.10.0
Instances
| POrd PBitString Source # | Since: 1.10.0 |
Defined in Plutarch.BitString Methods (#<=) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBool Source # (#<) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBool Source # pmax :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBitString Source # pmin :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBitString Source # | |
| POrd PBool Source # | |
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source # (#<) :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source # pmax :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source # pmin :: forall (s :: S). Term s PBool -> Term s PBool -> Term s PBool Source # | |
| POrd PByte Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source # (#<) :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PBool Source # pmax :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PByte Source # pmin :: forall (s :: S). Term s PByte -> Term s PByte -> Term s PByte Source # | |
| POrd PByteString Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source # (#<) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PBool Source # pmax :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source # pmin :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source # | |
| POrd PEndianness Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source # (#<) :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PBool Source # pmax :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PEndianness Source # pmin :: forall (s :: S). Term s PEndianness -> Term s PEndianness -> Term s PEndianness Source # | |
| POrd PLogicOpSemantics Source # | |
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # (#<) :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PBool Source # pmax :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PLogicOpSemantics Source # pmin :: forall (s :: S). Term s PLogicOpSemantics -> Term s PLogicOpSemantics -> Term s PLogicOpSemantics Source # | |
| POrd PInteger Source # | |
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source # (#<) :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PBool Source # pmax :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PInteger Source # pmin :: forall (s :: S). Term s PInteger -> Term s PInteger -> Term s PInteger Source # | |
| POrd PUnit Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Ord Methods (#<=) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source # (#<) :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PBool Source # pmax :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PUnit Source # pmin :: forall (s :: S). Term s PUnit -> Term s PUnit -> Term s PUnit Source # | |
| POrd PNatural Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods (#<=) :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PBool Source # (#<) :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PBool Source # pmax :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PNatural Source # pmin :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PNatural Source # | |
| POrd PPositive Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods (#<=) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source # (#<) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source # pmax :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PPositive Source # pmin :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PPositive Source # | |
| POrd PRational Source # | |
Defined in Plutarch.Rational Methods (#<=) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source # (#<) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source # pmax :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PRational Source # pmin :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PRational Source # | |
| (SListI xs, POrd x, PIsData x, POrd (PDataRecord (x' ': xs))) => POrd (PDataRecord ((label ':= x) ': (x' ': xs))) Source # | |
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source # pmin :: forall (s :: S). Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) -> Term s (PDataRecord ((label ':= x) ': (x' ': xs))) Source # | |
| (POrd x, PIsData x) => POrd (PDataRecord '[label ':= x]) Source # | |
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source # pmin :: forall (s :: S). Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) -> Term s (PDataRecord '[label ':= x]) Source # | |
| POrd (PDataRecord ('[] :: [PLabeledType])) Source # | |
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) Source # pmin :: forall (s :: S). Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s (PDataRecord ('[] :: [PLabeledType])) Source # | |
| All (Compose POrd PDataRecord) defs => POrd (PDataSum defs) Source # | |
Defined in Plutarch.DataRepr.Internal Methods (#<=) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s (PDataSum defs) Source # pmin :: forall (s :: S). Term s (PDataSum defs) -> Term s (PDataSum defs) -> Term s (PDataSum defs) Source # | |
| POrd a => POrd (PAnd a) Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<=) :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s (PAnd a) Source # pmin :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s (PAnd a) Source # | |
| POrd a => POrd (POr a) Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<=) :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s PBool Source # pmax :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s (POr a) Source # pmin :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s (POr a) Source # | |
| POrd a => POrd (PXor a) Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<=) :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s (PXor a) Source # pmin :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s (PXor a) Source # | |
| (POrd a, POrd b, PIsData a, PIsData b) => POrd (PEitherData a b) Source # | Since: 1.10.0 |
Defined in Plutarch.Either Methods (#<=) :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s (PEitherData a b) Source # pmin :: forall (s :: S). Term s (PEitherData a b) -> Term s (PEitherData a b) -> Term s (PEitherData a b) Source # | |
(#>) :: forall (a :: S -> Type) (s :: S). POrd a => Term s a -> Term s a -> Term s PBool infix 4 Source #
Since: 1.10.0
(#>=) :: forall (a :: S -> Type) (s :: S). POrd a => Term s a -> Term s a -> Term s PBool infix 4 Source #
Since: 1.10.0
Fixed point
pfixHoisted :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (((a :--> b) :--> (a :--> b)) :--> (a :--> b)) Source #
Fixpoint recursion, used to encode recursive functions.
Note
This fixpoint combinator is hoisted, which allows for the smallest code
size. However, in terms of execution units, pfixHoisted is the least
efficient.
pfixHoisted used to be the default fixpoint combinator in Plutarch. If you
used pfix before, and want to maintain identical behaviour, use this
function.
Example
Additional examples can be found in examples/Recursion.hs.
iterateN' ::
Term s (PInteger :--> (a :--> a) :--> a :--> a) ->
Term s PInteger ->
Term s (a :--> a) ->
Term s a
iterateN' self n f x =
pif (n #== 0)
x
(self # n - 1 #$ f x)
iterateN :: Term s (PInteger :--> (a :--> a) :--> a :--> a)
iterateN = pfixHoisted #$ plam iterateN'Since: 1.12.0
pfix :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b) Source #
As pfixHoisted, but not hoisted. This is more efficient in terms of
execution units, but takes up more script space.
Since: 1.12.0
pfixInline :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b) Source #
As pfix, but we perform some additional inlining into the function
argument. This allows for even more speed, but at the cost of larger scripts.
Since: 1.12.0
IsData
class PIsData (a :: S -> Type) where Source #
Laws:
- If PSubtype PData a, then pdataImpl a must be pupcast.
- pdataImpl . pupcast . pfromDataImpl ≡ id
- pfromDataImpl . punsafeDowncast . pdataImpl ≡ id
Minimal complete definition
Nothing
Methods
pfromDataImpl :: forall (s :: S). Term s (PAsData a) -> Term s a Source #
default pfromDataImpl :: forall (s :: S). PIsData (PInner a) => Term s (PAsData a) -> Term s a Source #
pdataImpl :: forall (s :: S). Term s a -> Term s PData Source #
Instances
| PIsData PBool Source # | |
| PIsData PByteString Source # | |
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData PByteString) -> Term s PByteString Source # pdataImpl :: forall (s :: S). Term s PByteString -> Term s PData Source # | |
| PIsData PData Source # | |
| PIsData PInteger Source # | |
| PIsData PUnit Source # | |
| PIsData PNatural Source # | Since: 1.10.0 |
| PIsData PPositive Source # | Since: 1.10.0 |
| (PInnermostIsData ('Just "PBuiltinList only implements PIsData when inner most type of its elements are PData") a, PSubtype PData a) => PIsData (PBuiltinList a) Source # | |
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PBuiltinList a)) -> Term s (PBuiltinList a) Source # pdataImpl :: forall (s :: S). Term s (PBuiltinList a) -> Term s PData Source # | |
| PIsData (PDataRecord xs) Source # | |
Defined in Plutarch.DataRepr.Internal Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PDataRecord xs)) -> Term s (PDataRecord xs) Source # pdataImpl :: forall (s :: S). Term s (PDataRecord xs) -> Term s PData Source # | |
| PIsData (PDataSum defs) Source # | |
| PIsData (PDataRec struct) Source # | Since: 1.10.0 |
| PIsData (PDataStruct struct) Source # | Since: 1.10.0 |
Defined in Plutarch.Repr.Data Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PDataStruct struct)) -> Term s (PDataStruct struct) Source # pdataImpl :: forall (s :: S). Term s (PDataStruct struct) -> Term s PData Source # | |
| PIsData (PBuiltinPair (PAsData a) (PAsData b)) Source # | |
Defined in Plutarch.Internal.IsData | |
| PIsData (PBuiltinPair PData PData) Source # | |
Defined in Plutarch.Internal.IsData | |
| PIsData (PBuiltinPair PInteger (PBuiltinList PData)) Source # | |
Defined in Plutarch.Internal.IsData Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PBuiltinPair PInteger (PBuiltinList PData))) -> Term s (PBuiltinPair PInteger (PBuiltinList PData)) Source # pdataImpl :: forall (s :: S). Term s (PBuiltinPair PInteger (PBuiltinList PData)) -> Term s PData Source # | |
| PIsData (PEitherData a b) Source # | Since: 1.10.0 |
Defined in Plutarch.Either Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PEitherData a b)) -> Term s (PEitherData a b) Source # pdataImpl :: forall (s :: S). Term s (PEitherData a b) -> Term s PData Source # | |
Lifting and lowering
class PlutusType a => PLiftable (a :: S -> Type) where Source #
Indicates that the given Plutarch type has an equivalent in Haskell (and Plutus by extension), and we have the ability to move between them.
Important note
Calling methods of PLiftable directly should rarely, if ever, be a
thing you do, unless defining your own instances without via-deriving
helpers (below). Prefer using pconstant and plift, as these handle
some of the oddities required without you having to think about them.
You should rarely, if ever, need to define PLiftable instances by hand.
Whenever possible, prefer using DeriveBuiltinPLiftable,
DeriveDataPLiftable, and DeriveNewtypePLiftable as they have fewer
complexities and caveats. See their documentation for when to use them.
If you do want to define the methods yourself, there's a few key factors to keep in mind:
- You still shouldn't write every method by hand, there are helpers
plutToReprUniandreprToPlutUnito cover common cases. - If defining
plutToReprandreprToPlutfor Scott encoded types you need to setPlutusReprPMyType =PLiftedClosedPMyType - When choosing a type for
AsHaskell, any value of that type must be representable in Plutarch. If you have internal invariants to maintain on the Haskell side, make sure you do so with great care.
Laws
Any derivations via DeriveBuiltinPLiftable, DeriveDataPLiftable, and
DeriveNewtypePLiftable automatically follow these laws.
Together, these imply plift . pconstant = id.
Since: 1.10.0
Methods
haskToRepr :: AsHaskell a -> PlutusRepr a Source #
Transform a's Haskell equivalent to its Plutus universe
representation.
reprToHask :: PlutusRepr a -> Either LiftError (AsHaskell a) Source #
Given a's Plutus universe representation, turn it back into its (true)
Haskell equivalent if possible.
reprToPlut :: forall (s :: S). PlutusRepr a -> PLifted s a Source #
Given a's Plutus universe representation, lift it into Plutarch.
plutToRepr :: (forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a) Source #
Given a closed Plutarch term, evaluate it back into its Plutus universe representation, or fail.
Instances
| PLiftable PBitString Source # | |||||||||
Defined in Plutarch.BitString Associated Types
Methods haskToRepr :: AsHaskell PBitString -> PlutusRepr PBitString Source # reprToHask :: PlutusRepr PBitString -> Either LiftError (AsHaskell PBitString) Source # reprToPlut :: forall (s :: S). PlutusRepr PBitString -> PLifted s PBitString Source # plutToRepr :: (forall (s :: S). PLifted s PBitString) -> Either LiftError (PlutusRepr PBitString) Source # | |||||||||
| PLiftable PBuiltinBLS12_381_G1_Element Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PBuiltinBLS12_381_G1_Element -> PlutusRepr PBuiltinBLS12_381_G1_Element Source # reprToHask :: PlutusRepr PBuiltinBLS12_381_G1_Element -> Either LiftError (AsHaskell PBuiltinBLS12_381_G1_Element) Source # reprToPlut :: forall (s :: S). PlutusRepr PBuiltinBLS12_381_G1_Element -> PLifted s PBuiltinBLS12_381_G1_Element Source # plutToRepr :: (forall (s :: S). PLifted s PBuiltinBLS12_381_G1_Element) -> Either LiftError (PlutusRepr PBuiltinBLS12_381_G1_Element) Source # | |||||||||
| PLiftable PBuiltinBLS12_381_G2_Element Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PBuiltinBLS12_381_G2_Element -> PlutusRepr PBuiltinBLS12_381_G2_Element Source # reprToHask :: PlutusRepr PBuiltinBLS12_381_G2_Element -> Either LiftError (AsHaskell PBuiltinBLS12_381_G2_Element) Source # reprToPlut :: forall (s :: S). PlutusRepr PBuiltinBLS12_381_G2_Element -> PLifted s PBuiltinBLS12_381_G2_Element Source # plutToRepr :: (forall (s :: S). PLifted s PBuiltinBLS12_381_G2_Element) -> Either LiftError (PlutusRepr PBuiltinBLS12_381_G2_Element) Source # | |||||||||
| PLiftable PBuiltinBLS12_381_MlResult Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PBuiltinBLS12_381_MlResult -> PlutusRepr PBuiltinBLS12_381_MlResult Source # reprToHask :: PlutusRepr PBuiltinBLS12_381_MlResult -> Either LiftError (AsHaskell PBuiltinBLS12_381_MlResult) Source # reprToPlut :: forall (s :: S). PlutusRepr PBuiltinBLS12_381_MlResult -> PLifted s PBuiltinBLS12_381_MlResult Source # plutToRepr :: (forall (s :: S). PLifted s PBuiltinBLS12_381_MlResult) -> Either LiftError (PlutusRepr PBuiltinBLS12_381_MlResult) Source # | |||||||||
| PLiftable PBool Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PBool -> PlutusRepr PBool Source # reprToHask :: PlutusRepr PBool -> Either LiftError (AsHaskell PBool) Source # reprToPlut :: forall (s :: S). PlutusRepr PBool -> PLifted s PBool Source # plutToRepr :: (forall (s :: S). PLifted s PBool) -> Either LiftError (PlutusRepr PBool) Source # | |||||||||
| PLiftable PByte Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PByte -> PlutusRepr PByte Source # reprToHask :: PlutusRepr PByte -> Either LiftError (AsHaskell PByte) Source # reprToPlut :: forall (s :: S). PlutusRepr PByte -> PLifted s PByte Source # plutToRepr :: (forall (s :: S). PLifted s PByte) -> Either LiftError (PlutusRepr PByte) Source # | |||||||||
| PLiftable PByteString Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PByteString -> PlutusRepr PByteString Source # reprToHask :: PlutusRepr PByteString -> Either LiftError (AsHaskell PByteString) Source # reprToPlut :: forall (s :: S). PlutusRepr PByteString -> PLifted s PByteString Source # plutToRepr :: (forall (s :: S). PLifted s PByteString) -> Either LiftError (PlutusRepr PByteString) Source # | |||||||||
| PLiftable PData Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PData -> PlutusRepr PData Source # reprToHask :: PlutusRepr PData -> Either LiftError (AsHaskell PData) Source # reprToPlut :: forall (s :: S). PlutusRepr PData -> PLifted s PData Source # plutToRepr :: (forall (s :: S). PLifted s PData) -> Either LiftError (PlutusRepr PData) Source # | |||||||||
| PLiftable PInteger Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PInteger -> PlutusRepr PInteger Source # reprToHask :: PlutusRepr PInteger -> Either LiftError (AsHaskell PInteger) Source # reprToPlut :: forall (s :: S). PlutusRepr PInteger -> PLifted s PInteger Source # plutToRepr :: (forall (s :: S). PLifted s PInteger) -> Either LiftError (PlutusRepr PInteger) Source # | |||||||||
| PLiftable PString Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PString -> PlutusRepr PString Source # reprToHask :: PlutusRepr PString -> Either LiftError (AsHaskell PString) Source # reprToPlut :: forall (s :: S). PlutusRepr PString -> PLifted s PString Source # plutToRepr :: (forall (s :: S). PLifted s PString) -> Either LiftError (PlutusRepr PString) Source # | |||||||||
| PLiftable PUnit Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell PUnit -> PlutusRepr PUnit Source # reprToHask :: PlutusRepr PUnit -> Either LiftError (AsHaskell PUnit) Source # reprToPlut :: forall (s :: S). PlutusRepr PUnit -> PLifted s PUnit Source # plutToRepr :: (forall (s :: S). PLifted s PUnit) -> Either LiftError (PlutusRepr PUnit) Source # | |||||||||
| PLiftable PNatural Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric Associated Types
Methods haskToRepr :: AsHaskell PNatural -> PlutusRepr PNatural Source # reprToHask :: PlutusRepr PNatural -> Either LiftError (AsHaskell PNatural) Source # reprToPlut :: forall (s :: S). PlutusRepr PNatural -> PLifted s PNatural Source # plutToRepr :: (forall (s :: S). PLifted s PNatural) -> Either LiftError (PlutusRepr PNatural) Source # | |||||||||
| PLiftable PPositive Source # | |||||||||
Defined in Plutarch.Internal.Numeric Associated Types
Methods haskToRepr :: AsHaskell PPositive -> PlutusRepr PPositive Source # reprToHask :: PlutusRepr PPositive -> Either LiftError (AsHaskell PPositive) Source # reprToPlut :: forall (s :: S). PlutusRepr PPositive -> PLifted s PPositive Source # plutToRepr :: (forall (s :: S). PLifted s PPositive) -> Either LiftError (PlutusRepr PPositive) Source # | |||||||||
| PLiftable PRational Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Rational Associated Types
Methods haskToRepr :: AsHaskell PRational -> PlutusRepr PRational Source # reprToHask :: PlutusRepr PRational -> Either LiftError (AsHaskell PRational) Source # reprToPlut :: forall (s :: S). PlutusRepr PRational -> PLifted s PRational Source # plutToRepr :: (forall (s :: S). PLifted s PRational) -> Either LiftError (PlutusRepr PRational) Source # | |||||||||
| (Contains DefaultUni (PlutusRepr a), PLiftable a, KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PArray a) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PArray a) -> PlutusRepr (PArray a) Source # reprToHask :: PlutusRepr (PArray a) -> Either LiftError (AsHaskell (PArray a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PArray a) -> PLifted s (PArray a) Source # plutToRepr :: (forall (s :: S). PLifted s (PArray a)) -> Either LiftError (PlutusRepr (PArray a)) Source # | |||||||||
| (ToData (AsHaskell a), FromData (AsHaskell a), PIsData a) => PLiftable (PAsData a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PAsData a) -> PlutusRepr (PAsData a) Source # reprToHask :: PlutusRepr (PAsData a) -> Either LiftError (AsHaskell (PAsData a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PAsData a) -> PLifted s (PAsData a) Source # plutToRepr :: (forall (s :: S). PLifted s (PAsData a)) -> Either LiftError (PlutusRepr (PAsData a)) Source # | |||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PBuiltinList a) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PBuiltinList a) -> PlutusRepr (PBuiltinList a) Source # reprToHask :: PlutusRepr (PBuiltinList a) -> Either LiftError (AsHaskell (PBuiltinList a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PBuiltinList a) -> PLifted s (PBuiltinList a) Source # plutToRepr :: (forall (s :: S). PLifted s (PBuiltinList a)) -> Either LiftError (PlutusRepr (PBuiltinList a)) Source # | |||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PAnd a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
Methods haskToRepr :: AsHaskell (PAnd a) -> PlutusRepr (PAnd a) Source # reprToHask :: PlutusRepr (PAnd a) -> Either LiftError (AsHaskell (PAnd a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PAnd a) -> PLifted s (PAnd a) Source # plutToRepr :: (forall (s :: S). PLifted s (PAnd a)) -> Either LiftError (PlutusRepr (PAnd a)) Source # | |||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (POr a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
Methods haskToRepr :: AsHaskell (POr a) -> PlutusRepr (POr a) Source # reprToHask :: PlutusRepr (POr a) -> Either LiftError (AsHaskell (POr a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (POr a) -> PLifted s (POr a) Source # plutToRepr :: (forall (s :: S). PLifted s (POr a)) -> Either LiftError (PlutusRepr (POr a)) Source # | |||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PXor a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
Methods haskToRepr :: AsHaskell (PXor a) -> PlutusRepr (PXor a) Source # reprToHask :: PlutusRepr (PXor a) -> Either LiftError (AsHaskell (PXor a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PXor a) -> PLifted s (PXor a) Source # plutToRepr :: (forall (s :: S). PLifted s (PXor a)) -> Either LiftError (PlutusRepr (PXor a)) Source # | |||||||||
| PLiftable a => PLiftable (PMaybe a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Maybe Associated Types
Methods haskToRepr :: AsHaskell (PMaybe a) -> PlutusRepr (PMaybe a) Source # reprToHask :: PlutusRepr (PMaybe a) -> Either LiftError (AsHaskell (PMaybe a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PMaybe a) -> PLifted s (PMaybe a) Source # plutToRepr :: (forall (s :: S). PLifted s (PMaybe a)) -> Either LiftError (PlutusRepr (PMaybe a)) Source # | |||||||||
| (SListI struct, All EachDataLiftable struct, All PInnermostIsDataDataRepr struct, hstruct ~ RecAsHaskell struct, AllZip ToAsHaskell hstruct struct) => PLiftable (PDataRec struct) Source # | @since WIP | ||||||||
Defined in Plutarch.Repr.Data Associated Types
Methods haskToRepr :: AsHaskell (PDataRec struct) -> PlutusRepr (PDataRec struct) Source # reprToHask :: PlutusRepr (PDataRec struct) -> Either LiftError (AsHaskell (PDataRec struct)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PDataRec struct) -> PLifted s (PDataRec struct) Source # plutToRepr :: (forall (s :: S). PLifted s (PDataRec struct)) -> Either LiftError (PlutusRepr (PDataRec struct)) Source # | |||||||||
| (SListI struct, hstruct ~ RecAsHaskell struct, AllZip ToAsHaskell hstruct struct, All PLiftable struct) => PLiftable (PSOPRec struct) Source # | @since WIP | ||||||||
Defined in Plutarch.Repr.SOP Associated Types
Methods haskToRepr :: AsHaskell (PSOPRec struct) -> PlutusRepr (PSOPRec struct) Source # reprToHask :: PlutusRepr (PSOPRec struct) -> Either LiftError (AsHaskell (PSOPRec struct)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PSOPRec struct) -> PLifted s (PSOPRec struct) Source # plutToRepr :: (forall (s :: S). PLifted s (PSOPRec struct)) -> Either LiftError (PlutusRepr (PSOPRec struct)) Source # | |||||||||
| (SListI2 struct, hstruct ~ StructAsHaskell struct, AllZip2 ToAsHaskell hstruct struct, All2 PLiftable struct, MyAll SOPEntryConstraints SOPRestConstraint struct, PSOPStructConstraint struct) => PLiftable (PSOPStruct struct) Source # | @since WIP | ||||||||
Defined in Plutarch.Repr.SOP Associated Types
Methods haskToRepr :: AsHaskell (PSOPStruct struct) -> PlutusRepr (PSOPStruct struct) Source # reprToHask :: PlutusRepr (PSOPStruct struct) -> Either LiftError (AsHaskell (PSOPStruct struct)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PSOPStruct struct) -> PLifted s (PSOPStruct struct) Source # plutToRepr :: (forall (s :: S). PLifted s (PSOPStruct struct)) -> Either LiftError (PlutusRepr (PSOPStruct struct)) Source # | |||||||||
| (PlutusType (DeriveAsTag a), Generic (a (Any :: S)), TagTypeConstraints (Any :: S) a struct) => PLiftable (DeriveAsTag a) Source # | |||||||||
Defined in Plutarch.Repr.Tag Associated Types
Methods haskToRepr :: AsHaskell (DeriveAsTag a) -> PlutusRepr (DeriveAsTag a) Source # reprToHask :: PlutusRepr (DeriveAsTag a) -> Either LiftError (AsHaskell (DeriveAsTag a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (DeriveAsTag a) -> PLifted s (DeriveAsTag a) Source # plutToRepr :: (forall (s :: S). PLifted s (DeriveAsTag a)) -> Either LiftError (PlutusRepr (DeriveAsTag a)) Source # | |||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a), PLiftable b, Includes DefaultUni (PlutusRepr b), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr b)) => PLiftable (PBuiltinPair a b) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PBuiltinPair a b) -> PlutusRepr (PBuiltinPair a b) Source # reprToHask :: PlutusRepr (PBuiltinPair a b) -> Either LiftError (AsHaskell (PBuiltinPair a b)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PBuiltinPair a b) -> PLifted s (PBuiltinPair a b) Source # plutToRepr :: (forall (s :: S). PLifted s (PBuiltinPair a b)) -> Either LiftError (PlutusRepr (PBuiltinPair a b)) Source # | |||||||||
| (PLiftable a, PLiftable b) => PLiftable (PEither a b) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Either Associated Types
Methods haskToRepr :: AsHaskell (PEither a b) -> PlutusRepr (PEither a b) Source # reprToHask :: PlutusRepr (PEither a b) -> Either LiftError (AsHaskell (PEither a b)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PEither a b) -> PLifted s (PEither a b) Source # plutToRepr :: (forall (s :: S). PLifted s (PEither a b)) -> Either LiftError (PlutusRepr (PEither a b)) Source # | |||||||||
| (ToData (AsHaskell a), FromData (AsHaskell a), ToData (AsHaskell b), FromData (AsHaskell b)) => PLiftable (PEitherData a b) Source # | |||||||||
Defined in Plutarch.Either Associated Types
Methods haskToRepr :: AsHaskell (PEitherData a b) -> PlutusRepr (PEitherData a b) Source # reprToHask :: PlutusRepr (PEitherData a b) -> Either LiftError (AsHaskell (PEitherData a b)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PEitherData a b) -> PLifted s (PEitherData a b) Source # plutToRepr :: (forall (s :: S). PLifted s (PEitherData a b)) -> Either LiftError (PlutusRepr (PEitherData a b)) Source # | |||||||||
| (PlutusType a, Includes DefaultUni h, KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) h) => PLiftable (DeriveBuiltinPLiftable a h) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (DeriveBuiltinPLiftable a h) -> PlutusRepr (DeriveBuiltinPLiftable a h) Source # reprToHask :: PlutusRepr (DeriveBuiltinPLiftable a h) -> Either LiftError (AsHaskell (DeriveBuiltinPLiftable a h)) Source # reprToPlut :: forall (s :: S). PlutusRepr (DeriveBuiltinPLiftable a h) -> PLifted s (DeriveBuiltinPLiftable a h) Source # plutToRepr :: (forall (s :: S). PLifted s (DeriveBuiltinPLiftable a h)) -> Either LiftError (PlutusRepr (DeriveBuiltinPLiftable a h)) Source # | |||||||||
| (PlutusType a, PSubtype PData a, ToData h, FromData h) => PLiftable (DeriveDataPLiftable a h) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (DeriveDataPLiftable a h) -> PlutusRepr (DeriveDataPLiftable a h) Source # reprToHask :: PlutusRepr (DeriveDataPLiftable a h) -> Either LiftError (AsHaskell (DeriveDataPLiftable a h)) Source # reprToPlut :: forall (s :: S). PlutusRepr (DeriveDataPLiftable a h) -> PLifted s (DeriveDataPLiftable a h) Source # plutToRepr :: (forall (s :: S). PLifted s (DeriveDataPLiftable a h)) -> Either LiftError (PlutusRepr (DeriveDataPLiftable a h)) Source # | |||||||||
| (PLiftable (PInner wrapper), Coercible h (AsHaskell (PInner wrapper)), Includes DefaultUni (PlutusRepr (PInner wrapper)), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr (PInner wrapper))) => PLiftable (DeriveNewtypePLiftable wrapper h) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (DeriveNewtypePLiftable wrapper h) -> PlutusRepr (DeriveNewtypePLiftable wrapper h) Source # reprToHask :: PlutusRepr (DeriveNewtypePLiftable wrapper h) -> Either LiftError (AsHaskell (DeriveNewtypePLiftable wrapper h)) Source # reprToPlut :: forall (s :: S). PlutusRepr (DeriveNewtypePLiftable wrapper h) -> PLifted s (DeriveNewtypePLiftable wrapper h) Source # plutToRepr :: (forall (s :: S). PLifted s (DeriveNewtypePLiftable wrapper h)) -> Either LiftError (PlutusRepr (DeriveNewtypePLiftable wrapper h)) Source # | |||||||||
| (PLiftable (PInner wrapper), Generic (wrapper (Any :: S)), Generic h, hstruct ~ Code h, struct' ~ Code (wrapper (Any :: S)), struct ~ UnTermStruct' struct', hstruct ~ StructAsHaskell struct, AsHaskell (PInner wrapper) ~ SOP I hstruct) => PLiftable (DerivePLiftableAsRepr wrapper h) Source # | @since WIP | ||||||||
Defined in Plutarch.Repr.Derive Associated Types
Methods haskToRepr :: AsHaskell (DerivePLiftableAsRepr wrapper h) -> PlutusRepr (DerivePLiftableAsRepr wrapper h) Source # reprToHask :: PlutusRepr (DerivePLiftableAsRepr wrapper h) -> Either LiftError (AsHaskell (DerivePLiftableAsRepr wrapper h)) Source # reprToPlut :: forall (s :: S). PlutusRepr (DerivePLiftableAsRepr wrapper h) -> PLifted s (DerivePLiftableAsRepr wrapper h) Source # plutToRepr :: (forall (s :: S). PLifted s (DerivePLiftableAsRepr wrapper h)) -> Either LiftError (PlutusRepr (DerivePLiftableAsRepr wrapper h)) Source # | |||||||||
data DeriveDataPLiftable (a :: S -> Type) h (s :: S) Source #
via-deriving helper, indicating that a has a Haskell-level equivalent
h by way of its Data encoding, rather than by h being directly part of
the Plutus default universe.
Since: 1.10.0
Instances
| (PlutusType a, PSubtype PData a, ToData h, FromData h) => PLiftable (DeriveDataPLiftable a h) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (DeriveDataPLiftable a h) -> PlutusRepr (DeriveDataPLiftable a h) Source # reprToHask :: PlutusRepr (DeriveDataPLiftable a h) -> Either LiftError (AsHaskell (DeriveDataPLiftable a h)) Source # reprToPlut :: forall (s :: S). PlutusRepr (DeriveDataPLiftable a h) -> PLifted s (DeriveDataPLiftable a h) Source # plutToRepr :: (forall (s :: S). PLifted s (DeriveDataPLiftable a h)) -> Either LiftError (PlutusRepr (DeriveDataPLiftable a h)) Source # | |||||||||
| PlutusType (DeriveDataPLiftable a h) Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods pcon' :: forall (s :: S). DeriveDataPLiftable a h s -> Term s (PInner (DeriveDataPLiftable a h)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveDataPLiftable a h)) -> (DeriveDataPLiftable a h s -> Term s b) -> Term s b Source # | |||||||||
| Generic (DeriveDataPLiftable a h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods from :: DeriveDataPLiftable a h s -> Rep (DeriveDataPLiftable a h s) x Source # to :: Rep (DeriveDataPLiftable a h s) x -> DeriveDataPLiftable a h s Source # | |||||||||
| Generic (DeriveDataPLiftable a h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods from :: DeriveDataPLiftable a h s -> Rep (DeriveDataPLiftable a h s) to :: Rep (DeriveDataPLiftable a h s) -> DeriveDataPLiftable a h s | |||||||||
| type AsHaskell (DeriveDataPLiftable a h) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr (DeriveDataPLiftable a h) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner (DeriveDataPLiftable a h) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type Rep (DeriveDataPLiftable a h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift type Rep (DeriveDataPLiftable a h s) = D1 ('MetaData "DeriveDataPLiftable" "Plutarch.Internal.Lift" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "DeriveDataPLiftable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (a s)))) | |||||||||
| type Code (DeriveDataPLiftable a h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
data DeriveNewtypePLiftable (wrapper :: S -> Type) h (s :: S) Source #
via-deriving helper, indicating that wrapper has a Haskell-level equivalent
h by way PInner wrapper, up to coercibility.
Since: 1.10.0
Instances
| (PLiftable (PInner wrapper), Coercible h (AsHaskell (PInner wrapper)), Includes DefaultUni (PlutusRepr (PInner wrapper)), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr (PInner wrapper))) => PLiftable (DeriveNewtypePLiftable wrapper h) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (DeriveNewtypePLiftable wrapper h) -> PlutusRepr (DeriveNewtypePLiftable wrapper h) Source # reprToHask :: PlutusRepr (DeriveNewtypePLiftable wrapper h) -> Either LiftError (AsHaskell (DeriveNewtypePLiftable wrapper h)) Source # reprToPlut :: forall (s :: S). PlutusRepr (DeriveNewtypePLiftable wrapper h) -> PLifted s (DeriveNewtypePLiftable wrapper h) Source # plutToRepr :: (forall (s :: S). PLifted s (DeriveNewtypePLiftable wrapper h)) -> Either LiftError (PlutusRepr (DeriveNewtypePLiftable wrapper h)) Source # | |||||||||
| PlutusType (DeriveNewtypePLiftable wrapper h) Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods pcon' :: forall (s :: S). DeriveNewtypePLiftable wrapper h s -> Term s (PInner (DeriveNewtypePLiftable wrapper h)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveNewtypePLiftable wrapper h)) -> (DeriveNewtypePLiftable wrapper h s -> Term s b) -> Term s b Source # | |||||||||
| Generic (DeriveNewtypePLiftable wrapper h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods from :: DeriveNewtypePLiftable wrapper h s -> Rep (DeriveNewtypePLiftable wrapper h s) x Source # to :: Rep (DeriveNewtypePLiftable wrapper h s) x -> DeriveNewtypePLiftable wrapper h s Source # | |||||||||
| Generic (DeriveNewtypePLiftable wrapper h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods from :: DeriveNewtypePLiftable wrapper h s -> Rep (DeriveNewtypePLiftable wrapper h s) to :: Rep (DeriveNewtypePLiftable wrapper h s) -> DeriveNewtypePLiftable wrapper h s | |||||||||
| type AsHaskell (DeriveNewtypePLiftable wrapper h) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr (DeriveNewtypePLiftable wrapper h) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner (DeriveNewtypePLiftable wrapper h) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Lift type PInner (DeriveNewtypePLiftable wrapper h) = PInner (DeriveFakePlutusType (DeriveNewtypePLiftable wrapper h)) | |||||||||
| type Rep (DeriveNewtypePLiftable wrapper h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift type Rep (DeriveNewtypePLiftable wrapper h s) = D1 ('MetaData "DeriveNewtypePLiftable" "Plutarch.Internal.Lift" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'True) (C1 ('MetaCons "DeriveNewtypePLiftable" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (wrapper s)))) | |||||||||
| type Code (DeriveNewtypePLiftable wrapper h s) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
newtype DeriveAsDataRec (a :: S -> Type) (s :: S) Source #
DeriveAsDataRec derives PlutusType instances for given type as builtin list of Data. Unlike PDataAsDataStruct above, this will
encode data as List. Similarly, only types with its innermost representation PData is allowed for its fields.
One major difference is that DeriveAsDataRec only allows single constructor as it does not encode the constructor index. When
attempted to use this strategy to a type with more than one constructor will result in type error with detailed explanation of the issue.
PInner of defined type will be PDataRec (struct :: [S -> Type]) where struct is product type of its structure. PInner of PDataRec struct
is PBuiltinList PData.
It is almost always better to use DeriveAsDataRec over DeriveAsDataStruct when data type only have one constructor as it is more efficient
to work with on-chain. However, Plith(previously PlutusTx), by default, derives every datatype to use Constr. So, if a Plutarch type needs to remain
compatible with type defined in Plith, one needs to use DeriveAsDataStruct. This is why many single-constructor types are derived using
DeriveAsDataStruct on plutarch-ledger-api.
Consult example below for defining custom data-encoded datatype: @@ data PBobData (a :: S -> Type) (s :: S) = PBobData (Term s (PAsData a)) (Term s (PAsData PBool)) deriving stock (Generic) deriving anyclass (SOP.Generic) deriving PlutusType via (DeriveAsDataRec (PBobData a))
pcon $ PBobData (pdata 10) (pdata pfalse) -- [#10, #false] @@
Since: 1.10.0
Constructors
| DeriveAsDataRec | |
Fields
| |
Instances
| (Generic (a (Any :: S)), All PInnermostIsDataDataRepr struct, struct ~ UnTermRec struct', Generic (a (Any :: S)), '[struct'] ~ Code (a (Any :: S)), All PValidateData struct, SListI struct) => PValidateData (DeriveAsDataRec a) Source # | Checks that we have a Since: 1.12.0 | ||||
| (Generic (a (Any :: S)), '[struct'] ~ Code (a (Any :: S)), struct ~ UnTermRec struct', All PInnermostIsDataDataRepr struct, SListI struct, forall (s :: S). StructSameRepr s a '[struct], RecTypePrettyError (Code (a (Any :: S)))) => PlutusType (DeriveAsDataRec a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Data Associated Types
Methods pcon' :: forall (s :: S). DeriveAsDataRec a s -> Term s (PInner (DeriveAsDataRec a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsDataRec a)) -> (DeriveAsDataRec a s -> Term s b) -> Term s b Source # | |||||
| type PInner (DeriveAsDataRec a) Source # | |||||
Defined in Plutarch.Repr.Data | |||||
newtype DeriveAsDataStruct (a :: S -> Type) (s :: S) Source #
DeriveAsDataStruct derives PlutusType instances for the given type as Data structure, namely, using Constr constructor
of the Data type. Each constructor of the given type will have matching constructor index in the order of its definition.
Also, it is important to note that each fields can only contain term that has innermost representation of Data. Hence,
PInteger is not allowed but PAsData PInteger is allowed. Failure to follow this requirement will result in type error
with detailed explanation of the issue.
PInner of defined type will be PDataStruct (struct :: [[S -> Type]]) where struct is SOP type of its structure. Since PInner of
PDataStruct is PData, multiple data encoded structure can be nested without being wrapped in PAsData.
Consult example below for defining custom data-encoded datatype: @@ data PBobData (a :: S -> Type) (s :: S) = PBobData (Term s (PAsData a)) (Term s (PAsData PBool)) | PRobData (Term s (PAsData PByteString)) deriving stock (Generic) deriving anyclass (SOP.Generic) deriving PlutusType via (DeriveAsDataStruct (PBobData a))
pcon $ PBobData (pdata 10) (pdata pfalse) -- Constr 0 [#10, #false] pcon $ PRobData "hello" -- Constr 1 [#"hello"] @@
Since: 1.10.0
Constructors
| DeriveAsDataStruct | |
Fields
| |
Instances
| (Generic (a (Any :: S)), struct ~ UnTermStruct (a (Any :: S)), All2 PInnermostIsDataDataRepr struct, All2 PValidateData struct, SListI2 struct) => PValidateData (DeriveAsDataStruct a) Source # | Checks that we have a Since: 1.12.0 | ||||
| (Generic (a (Any :: S)), struct ~ UnTermStruct (a (Any :: S)), All2 PInnermostIsDataDataRepr struct, SListI2 struct, forall (s :: S). StructSameRepr s a struct) => PlutusType (DeriveAsDataStruct a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Data Associated Types
Methods pcon' :: forall (s :: S). DeriveAsDataStruct a s -> Term s (PInner (DeriveAsDataStruct a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsDataStruct a)) -> (DeriveAsDataStruct a s -> Term s b) -> Term s b Source # | |||||
| type PInner (DeriveAsDataStruct a) Source # | |||||
Defined in Plutarch.Repr.Data | |||||
newtype DeriveAsSOPRec (a :: S -> Type) (s :: S) Source #
via-derivation helper for SOP encoding, currently behaves exactly like DeriveAsSOPStruct
but can be used only on types with a single constructor. It is separate to leave a room for
future optimizations.
Since: 1.10.0
Constructors
| DeriveAsSOPRec | |
Fields
| |
Instances
| (Generic (a (Any :: S)), '[struct'] ~ Code (a (Any :: S)), struct ~ UnTermRec struct', SListI struct, forall (s :: S). StructSameRepr s a '[struct], RecTypePrettyError (Code (a (Any :: S)))) => PlutusType (DeriveAsSOPRec a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.SOP Associated Types
Methods pcon' :: forall (s :: S). DeriveAsSOPRec a s -> Term s (PInner (DeriveAsSOPRec a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsSOPRec a)) -> (DeriveAsSOPRec a s -> Term s b) -> Term s b Source # | |||||
| type PInner (DeriveAsSOPRec a) Source # | |||||
Defined in Plutarch.Repr.SOP | |||||
newtype DeriveAsSOPStruct (a :: S -> Type) (s :: S) Source #
via-derivation helper to derive PlutusType instance using SoP encoding. If your type has
only one constructor prefer using DeriveAsSOPRec instead.
Since: 1.10.0
Constructors
| DeriveAsSOPStruct | |
Fields
| |
Instances
| (Generic (a (Any :: S)), struct ~ UnTermStruct (a (Any :: S)), SListI2 struct, forall (s :: S). StructSameRepr s a struct, PSOPStructConstraint struct) => PlutusType (DeriveAsSOPStruct a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.SOP Associated Types
Methods pcon' :: forall (s :: S). DeriveAsSOPStruct a s -> Term s (PInner (DeriveAsSOPStruct a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsSOPStruct a)) -> (DeriveAsSOPStruct a s -> Term s b) -> Term s b Source # | |||||
| type PInner (DeriveAsSOPStruct a) Source # | |||||
Defined in Plutarch.Repr.SOP | |||||
newtype PLifted (s :: S) (a :: S -> Type) Source #
Similar to Identity, but at the level of Plutarch. Only needed when
writing manual instances of PLiftable, or if you want to use reprToPlut
and plutToRepr directly.
This is used for coercing Plutarch terms at Haskell level with
`coerce :: PLifted s a -> PLifted s b` for via-deriving helpers.
Since: 1.10.0
reprToPlutUni :: forall (a :: S -> Type) (s :: S). Includes DefaultUni (PlutusRepr a) => PlutusRepr a -> PLifted s a Source #
Valid definition of reprToPlut if PlutusRepr a is in the Plutus universe.
Since: 1.13.0
plutToReprUni :: forall (a :: S -> Type). KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a) => (forall (s :: S). PLifted s a) -> Either LiftError (PlutusRepr a) Source #
Valid definition of plutToRepr if PlutusRepr a is in the Plutus
universe.
Since: 1.13.0
pconstant :: forall (a :: S -> Type) (s :: S). PLiftable a => AsHaskell a -> Term s a Source #
Given a Haskell-level representation of a Plutarch term, transform it into its equivalent term.
Since: 1.10.0
plift :: forall (a :: S -> Type). PLiftable a => (forall (s :: S). Term s a) -> AsHaskell a Source #
Given a closed Plutarch term, compile and evaluate it, then produce the
corresponding Haskell value. If compilation or evaluation fails somehow, this
will call error: if you need to 'trap' these outcomes and handle them
differently somehow, use reprToPlut and reprToHask manually.
Since: 1.10.0
Lists
type family PElemConstraint (list :: (S -> Type) -> S -> Type) (a :: S -> Type) Source #
Instances
| type PElemConstraint PBuiltinList a Source # | |
Defined in Plutarch.Internal.ListLike | |
| type PElemConstraint PList _1 Source # | |
Defined in Plutarch.List | |
type PIsListLike (list :: (S -> Type) -> S -> Type) (a :: S -> Type) = (PListLike list, PElemConstraint list a) Source #
'PIsListLike list a' constraints list be a PListLike with valid element type, a.
class PListLike (list :: (S -> Type) -> S -> Type) Source #
Plutarch types that behave like lists.
Instances
| PListLike PBuiltinList Source # | |||||
Defined in Plutarch.Internal.ListLike Associated Types
Methods pelimList :: forall (a :: S -> Type) (s :: S) (r :: S -> Type). PElemConstraint PBuiltinList a => (Term s a -> Term s (PBuiltinList a) -> Term s r) -> Term s r -> Term s (PBuiltinList a) -> Term s r Source # pcons :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (a :--> (PBuiltinList a :--> PBuiltinList a)) Source # pnil :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a) Source # phead :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a :--> a) Source # ptail :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a :--> PBuiltinList a) Source # pnull :: forall (a :: S -> Type) (s :: S). PElemConstraint PBuiltinList a => Term s (PBuiltinList a :--> PBool) Source # | |||||
| PListLike PList Source # | |||||
Defined in Plutarch.List Associated Types
Methods pelimList :: forall (a :: S -> Type) (s :: S) (r :: S -> Type). PElemConstraint PList a => (Term s a -> Term s (PList a) -> Term s r) -> Term s r -> Term s (PList a) -> Term s r Source # pcons :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (a :--> (PList a :--> PList a)) Source # pnil :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a) Source # phead :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a :--> a) Source # ptail :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a :--> PList a) Source # pnull :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a :--> PBool) Source # | |||||
data PList (a :: S -> Type) (s :: S) Source #
SOP-encoded list.
Since: 1.10.0
Instances
| PListLike PList Source # | |||||
Defined in Plutarch.List Associated Types
Methods pelimList :: forall (a :: S -> Type) (s :: S) (r :: S -> Type). PElemConstraint PList a => (Term s a -> Term s (PList a) -> Term s r) -> Term s r -> Term s (PList a) -> Term s r Source # pcons :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (a :--> (PList a :--> PList a)) Source # pnil :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a) Source # phead :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a :--> a) Source # ptail :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a :--> PList a) Source # pnull :: forall (a :: S -> Type) (s :: S). PElemConstraint PList a => Term s (PList a :--> PBool) Source # | |||||
| PEq a => PEq (PList a) Source # | |||||
| PlutusType (PList a) Source # | |||||
Defined in Plutarch.List Associated Types
| |||||
| PShow a => PShow (PList a) Source # | |||||
| Generic (PList a s) Source # | |||||
Defined in Plutarch.List Associated Types
| |||||
| Generic (PList a s) Source # | |||||
| type PElemConstraint PList _1 Source # | |||||
Defined in Plutarch.List | |||||
| type PInner (PList a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.List | |||||
| type Rep (PList a s) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.List type Rep (PList a s) = D1 ('MetaData "PList" "Plutarch.List" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'False) (C1 ('MetaCons "PSCons" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PList a)))) :+: C1 ('MetaCons "PSNil" 'PrefixI 'False) (U1 :: Type -> Type)) | |||||
| type Code (PList a s) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.List | |||||
pelem :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PIsListLike list a, PEq a) => Term s (a :--> (list a :--> PBool)) Source #
O(n) . Check if element is in the list
pelemAt :: forall (l :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike l a => Term s (PInteger :--> (l a :--> a)) Source #
O(n) . Like Haskell level (!!) but on the Plutarch level, not infix and
with arguments reversed, errors if the specified index is greater than or equal
to the lists length
pfind :: forall (l :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike l a => Term s ((a :--> PBool) :--> (l a :--> PMaybe a)) Source #
O(n) . like haskell level find but on plutarch level
plistEquals :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). (PIsListLike list a, PEq a) => Term s (list a :--> (list a :--> PBool)) Source #
O(min(n, m)) . Check if two lists are equal.
puncons :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (list a :--> PMaybe (PPair a (list a))) Source #
Extract head and tail of the list, if list is not empty.
pzip :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b, PElemConstraint list (PPair a b)) => Term s (list a :--> (list b :--> list (PPair a b))) Source #
O(min(n, m)) . Zip two lists together, creating pairs of the elements.
If the lists are of differing lengths, cut to the shortest.
(#!!) :: forall (l :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike l a => Term s (l a) -> Term s PInteger -> Term s a Source #
O(n) . Like Haskell level (!!) but on the plutarch level
pall :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s ((a :--> PBool) :--> (list a :--> PBool)) Source #
O(n) . Check that predicate holds for all elements in a list.
pany :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s ((a :--> PBool) :--> (list a :--> PBool)) Source #
O(n) . Check that predicate holds for any element in a list.
pconcat :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (list a :--> (list a :--> list a)) Source #
O(n) . Concatenate two lists
Example: > pconcat # psingleton x # psingleton y == plistLiteral [x, y]
pconcat exhibits identities with empty lists such that > forall x. pconcat # pnil # x == x > forall x. pconcat # x # pnil == x
pcons :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (a :--> (list a :--> list a)) Source #
Cons an element onto an existing list.
pdrop :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Natural -> Term s (list a) -> Term s (list a) Source #
Drop the first n fields of a List.
The term will be statically generated as
repeated applications of ptail, which will be more
efficient in many circumstances.
pelimList :: forall (a :: S -> Type) (s :: S) (r :: S -> Type). (PListLike list, PElemConstraint list a) => (Term s a -> Term s (list a) -> Term s r) -> Term s r -> Term s (list a) -> Term s r Source #
Canonical eliminator for list-likes.
pfilter :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s ((a :--> PBool) :--> (list a :--> list a)) Source #
O(n) . Filter elements from a list that don't match the predicate.
pfoldl :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (b :: S -> Type). PIsListLike list a => Term s ((b :--> (a :--> b)) :--> (b :--> (list a :--> b))) Source #
O(n) . Fold on a list left-associatively.
pfoldr :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (b :: S -> Type). PIsListLike list a => Term s ((a :--> (b :--> b)) :--> (b :--> (list a :--> b))) Source #
O(n) . Fold on a list right-associatively.
pfoldrLazy :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (b :: S -> Type). PIsListLike list a => Term s ((a :--> (PDelayed b :--> b)) :--> (b :--> (list a :--> b))) Source #
O(n) . Fold on a list right-associatively, with opportunity for short circuting.
May short circuit when given reducer function is lazy in its second argument.
phead :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a :--> a) Source #
Return the first element of a list. Partial, throws an error upon encountering an empty list.
plength :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (list a :--> PInteger) Source #
O(n) . Count the number of elements in the list
pmap :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b) => Term s ((a :--> b) :--> (list a :--> list b)) Source #
O(n) . Map a function over a list of elements
pnil :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a) Source #
The empty list
pnull :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a :--> PBool) Source #
O(1) . Check if a list is empty
precList :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S) (r :: S -> Type). PIsListLike list a => (Term s (list a :--> r) -> Term s a -> Term s (list a) -> Term s r) -> (Term s (list a :--> r) -> Term s r) -> Term s (list a :--> r) Source #
Like pelimList, but with a fixpoint recursion hatch.
psingleton :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Term s (a :--> list a) Source #
O(1) . Create a singleton list from an element
ptail :: forall (a :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a) => Term s (list a :--> list a) Source #
Take the tail of a list, meaning drop its head. Partial, throws an error upon encountering an empty list.
ptryIndex :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (s :: S). PIsListLike list a => Natural -> Term s (list a) -> Term s a Source #
Index a BuiltinList, throwing an error if the index is out of bounds.
pzipWith :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b, PElemConstraint list c) => Term s ((a :--> (b :--> c)) :--> (list a :--> (list b :--> list c))) Source #
O(min(n, m)) . Zip two lists together with a passed function.
If the lists are of differing lengths, cut to the shortest.
pzipWith' :: forall (list :: (S -> Type) -> S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (PListLike list, PElemConstraint list a, PElemConstraint list b, PElemConstraint list c) => (Term s a -> Term s b -> Term s c) -> Term s (list a :--> (list b :--> list c)) Source #
Like pzipWith but with Haskell-level merge function.
Arrays
data PArray (a :: S -> Type) (s :: S) Source #
A packed collection of values.
Since: 1.11.0
Instances
| (Contains DefaultUni (PlutusRepr a), PLiftable a, KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PArray a) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Lift Associated Types
Methods haskToRepr :: AsHaskell (PArray a) -> PlutusRepr (PArray a) Source # reprToHask :: PlutusRepr (PArray a) -> Either LiftError (AsHaskell (PArray a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PArray a) -> PLifted s (PArray a) Source # plutToRepr :: (forall (s :: S). PLifted s (PArray a)) -> Either LiftError (PlutusRepr (PArray a)) Source # | |||||||||
| PlutusType (PArray a) Source # | Since: 1.11.0 | ||||||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||||||
| Generic (PArray a s) Source # | |||||||||
Defined in Plutarch.Builtin.Array Associated Types
| |||||||||
| Generic (PArray a s) Source # | |||||||||
| type AsHaskell (PArray a) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PlutusRepr (PArray a) Source # | |||||||||
Defined in Plutarch.Internal.Lift | |||||||||
| type PInner (PArray a) Source # | |||||||||
Defined in Plutarch.Internal.PlutusType | |||||||||
| type Rep (PArray a s) Source # | Since: 1.11.0 | ||||||||
Defined in Plutarch.Builtin.Array | |||||||||
| type Code (PArray a s) Source # | Since: 1.11.0 | ||||||||
Defined in Plutarch.Builtin.Array | |||||||||
plengthOfArray :: forall (a :: S -> Type) (s :: S). Term s (PArray a :--> PInteger) Source #
Get the length of an array, as per CIP-138.
Since: 1.11.0
pindexArray :: forall (a :: S -> Type) (s :: S). Term s (PArray a :--> (PInteger :--> a)) Source #
Index an array, as per CIP-138.
Since: 1.11.0
plistToArray :: forall (a :: S -> Type) (s :: S). Term s (PBuiltinList a :--> PArray a) Source #
Convert a (builtin) list to an array with the same contents in the same order, as per CIP-138.
Since: 1.11.0
PlutusType
class (PInner a ~ DerivedPInner (DPTStrat a) a, PlutusTypeStrat (DPTStrat a), PlutusTypeStratConstraint (DPTStrat a) a, PlutusType a) => DerivePlutusType (a :: S -> Type) Source #
Deprecated: Use the new mechanisms instead
class PlutusType (a :: S -> Type) Source #
Associated Types
type PInner (a :: S -> Type) :: S -> Type Source #
type PInner (a :: S -> Type) = DerivedPInner (DPTStrat a) a
Instances
| PlutusType PBitString Source # | |||||
Defined in Plutarch.BitString Associated Types
Methods pcon' :: forall (s :: S). PBitString s -> Term s (PInner PBitString) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PBitString) -> (PBitString s -> Term s b) -> Term s b Source # | |||||
| PlutusType PBuiltinBLS12_381_G1_Element Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PBuiltinBLS12_381_G1_Element s -> Term s (PInner PBuiltinBLS12_381_G1_Element) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PBuiltinBLS12_381_G1_Element) -> (PBuiltinBLS12_381_G1_Element s -> Term s b) -> Term s b Source # | |||||
| PlutusType PBuiltinBLS12_381_G2_Element Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PBuiltinBLS12_381_G2_Element s -> Term s (PInner PBuiltinBLS12_381_G2_Element) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PBuiltinBLS12_381_G2_Element) -> (PBuiltinBLS12_381_G2_Element s -> Term s b) -> Term s b Source # | |||||
| PlutusType PBuiltinBLS12_381_MlResult Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PBuiltinBLS12_381_MlResult s -> Term s (PInner PBuiltinBLS12_381_MlResult) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PBuiltinBLS12_381_MlResult) -> (PBuiltinBLS12_381_MlResult s -> Term s b) -> Term s b Source # | |||||
| PlutusType PBool Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType PByte Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType PByteString Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PByteString s -> Term s (PInner PByteString) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PByteString) -> (PByteString s -> Term s b) -> Term s b Source # | |||||
| PlutusType PEndianness Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PEndianness s -> Term s (PInner PEndianness) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PEndianness) -> (PEndianness s -> Term s b) -> Term s b Source # | |||||
| PlutusType PLogicOpSemantics Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PLogicOpSemantics s -> Term s (PInner PLogicOpSemantics) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner PLogicOpSemantics) -> (PLogicOpSemantics s -> Term s b) -> Term s b Source # | |||||
| PlutusType PData Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType PInteger Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType POpaque Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType PString Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType PUnit Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType PNatural Source # | |||||
Defined in Plutarch.Internal.Numeric Associated Types
| |||||
| PlutusType PPositive Source # | |||||
Defined in Plutarch.Internal.Numeric Associated Types
| |||||
| PlutusType PRational Source # | |||||
Defined in Plutarch.Rational Associated Types
| |||||
| PlutusType (PPullArray a) Source # | Since: 1.13.0 | ||||
Defined in Plutarch.Array Associated Types
Methods pcon' :: forall (s :: S). PPullArray a s -> Term s (PInner (PPullArray a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PPullArray a)) -> (PPullArray a s -> Term s b) -> Term s b Source # | |||||
| PlutusType (PArray a) Source # | Since: 1.11.0 | ||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PIsData a => PlutusType (PAsData a) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| Contains DefaultUni (PlutusRepr a) => PlutusType (PBuiltinList a) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PBuiltinList a s -> Term s (PInner (PBuiltinList a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PBuiltinList a)) -> (PBuiltinList a s -> Term s b) -> Term s b Source # | |||||
| SListI l => PlutusType (PDataRecord l) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods pcon' :: forall (s :: S). PDataRecord l s -> Term s (PInner (PDataRecord l)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PDataRecord l)) -> (PDataRecord l s -> Term s b) -> Term s b Source # | |||||
| SListI defs => PlutusType (PDataSum defs) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| PlutusType a => PlutusType (Don'tValidate a) Source # | Since: 1.12.0 | ||||
Defined in Plutarch.Internal.Parse Associated Types
Methods pcon' :: forall (s :: S). Don'tValidate a s -> Term s (PInner (Don'tValidate a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (Don'tValidate a)) -> (Don'tValidate a s -> Term s b) -> Term s b Source # | |||||
| PlutusType (DeriveFakePlutusType a) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). DeriveFakePlutusType a s -> Term s (PInner (DeriveFakePlutusType a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveFakePlutusType a)) -> (DeriveFakePlutusType a s -> Term s b) -> Term s b Source # | |||||
| (pt ~ UnTermSingle (Head (Head (Code (a (Any :: S))))), forall (s :: S). H s a pt) => PlutusType (DeriveNewtypePlutusType a) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). DeriveNewtypePlutusType a s -> Term s (PInner (DeriveNewtypePlutusType a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveNewtypePlutusType a)) -> (DeriveNewtypePlutusType a s -> Term s b) -> Term s b Source # | |||||
| PlutusType (PFix f) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType (PAnd a) Source # | |||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||
| PlutusType (POr a) Source # | |||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||
| PlutusType (PXor a) Source # | |||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||
| PlutusType (PList a) Source # | |||||
Defined in Plutarch.List Associated Types
| |||||
| PlutusType (PMaybe a) Source # | |||||
Defined in Plutarch.Maybe Associated Types
| |||||
| (Generic (a (Any :: S)), '[struct'] ~ Code (a (Any :: S)), struct ~ UnTermRec struct', All PInnermostIsDataDataRepr struct, SListI struct, forall (s :: S). StructSameRepr s a '[struct], RecTypePrettyError (Code (a (Any :: S)))) => PlutusType (DeriveAsDataRec a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Data Associated Types
Methods pcon' :: forall (s :: S). DeriveAsDataRec a s -> Term s (PInner (DeriveAsDataRec a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsDataRec a)) -> (DeriveAsDataRec a s -> Term s b) -> Term s b Source # | |||||
| (Generic (a (Any :: S)), struct ~ UnTermStruct (a (Any :: S)), All2 PInnermostIsDataDataRepr struct, SListI2 struct, forall (s :: S). StructSameRepr s a struct) => PlutusType (DeriveAsDataStruct a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Data Associated Types
Methods pcon' :: forall (s :: S). DeriveAsDataStruct a s -> Term s (PInner (DeriveAsDataStruct a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsDataStruct a)) -> (DeriveAsDataStruct a s -> Term s b) -> Term s b Source # | |||||
| (SListI struct, All PInnermostIsDataDataRepr struct) => PlutusType (PDataRec struct) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Data Associated Types
| |||||
| (SListI2 struct, All2 PInnermostIsDataDataRepr struct) => PlutusType (PDataStruct struct) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Data Associated Types
Methods pcon' :: forall (s :: S). PDataStruct struct s -> Term s (PInner (PDataStruct struct)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PDataStruct struct)) -> (PDataStruct struct s -> Term s b) -> Term s b Source # | |||||
| (Generic (a (Any :: S)), '[struct'] ~ Code (a (Any :: S)), struct ~ UnTermRec struct', SListI struct, forall (s :: S). StructSameRepr s a '[struct], RecTypePrettyError (Code (a (Any :: S)))) => PlutusType (DeriveAsSOPRec a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.SOP Associated Types
Methods pcon' :: forall (s :: S). DeriveAsSOPRec a s -> Term s (PInner (DeriveAsSOPRec a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsSOPRec a)) -> (DeriveAsSOPRec a s -> Term s b) -> Term s b Source # | |||||
| (Generic (a (Any :: S)), struct ~ UnTermStruct (a (Any :: S)), SListI2 struct, forall (s :: S). StructSameRepr s a struct, PSOPStructConstraint struct) => PlutusType (DeriveAsSOPStruct a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.SOP Associated Types
Methods pcon' :: forall (s :: S). DeriveAsSOPStruct a s -> Term s (PInner (DeriveAsSOPStruct a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsSOPStruct a)) -> (DeriveAsSOPStruct a s -> Term s b) -> Term s b Source # | |||||
| SListI struct => PlutusType (PSOPRec struct) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.SOP Associated Types
| |||||
| (SListI2 struct, PSOPStructConstraint struct) => PlutusType (PSOPStruct struct) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.SOP Associated Types
Methods pcon' :: forall (s :: S). PSOPStruct struct s -> Term s (PInner (PSOPStruct struct)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PSOPStruct struct)) -> (PSOPStruct struct s -> Term s b) -> Term s b Source # | |||||
| (Generic (a (Any :: S)), '[struct'] ~ Code (a (Any :: S)), struct ~ UnTermRec struct', SListI struct, forall (s :: S). StructSameRepr s a '[struct], RecTypePrettyError (Code (a (Any :: S)))) => PlutusType (DeriveAsScottRec a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Scott Associated Types
Methods pcon' :: forall (s :: S). DeriveAsScottRec a s -> Term s (PInner (DeriveAsScottRec a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsScottRec a)) -> (DeriveAsScottRec a s -> Term s b) -> Term s b Source # | |||||
| (Generic (a (Any :: S)), struct ~ UnTermStruct (a (Any :: S)), SListI2 struct, forall (s :: S). StructSameRepr s a struct, PScottStructConstraint struct) => PlutusType (DeriveAsScottStruct a) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Scott Associated Types
Methods pcon' :: forall (s :: S). DeriveAsScottStruct a s -> Term s (PInner (DeriveAsScottStruct a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsScottStruct a)) -> (DeriveAsScottStruct a s -> Term s b) -> Term s b Source # | |||||
| SListI struct => PlutusType (PScottRec struct) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Scott Associated Types
| |||||
| (SListI2 struct, PScottStructConstraint struct) => PlutusType (PScottStruct struct) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Scott Associated Types
Methods pcon' :: forall (s :: S). PScottStruct struct s -> Term s (PInner (PScottStruct struct)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PScottStruct struct)) -> (PScottStruct struct s -> Term s b) -> Term s b Source # | |||||
| (forall (s :: S). TagTypeConstraints s a struct) => PlutusType (DeriveAsTag a) Source # | This derives tag-only PlutusType automatically. Resulted instances will use Example: @@ data PFoo s = A | B | C | D | E deriving stock (GHC.Generic, Show) deriving anyclass (PEq, PIsData) deriving (PlutusType, PLiftable) via DeriveAsTag PFoo instance SOP.Generic (PFoo s) @@ Since: 1.10.0 | ||||
Defined in Plutarch.Repr.Tag Associated Types
Methods pcon' :: forall (s :: S). DeriveAsTag a s -> Term s (PInner (DeriveAsTag a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveAsTag a)) -> (DeriveAsTag a s -> Term s b) -> Term s b Source # | |||||
| PlutusType (PTag struct) Source # | |||||
Defined in Plutarch.Repr.Tag Associated Types
| |||||
| PlutusType (PBuiltinPair a b) Source # | Important noteDue to some weirdnesses regarding builtins, Since: 1.12.0 | ||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). PBuiltinPair a b s -> Term s (PInner (PBuiltinPair a b)) Source # pmatch' :: forall (s :: S) (b0 :: S -> Type). Term s (PInner (PBuiltinPair a b)) -> (PBuiltinPair a b s -> Term s b0) -> Term s b0 Source # | |||||
| PlutusType (PEither a b) Source # | |||||
Defined in Plutarch.Either Associated Types
| |||||
| PlutusType (PEitherData a b) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Either Associated Types
Methods pcon' :: forall (s :: S). PEitherData a b s -> Term s (PInner (PEitherData a b)) Source # pmatch' :: forall (s :: S) (b0 :: S -> Type). Term s (PInner (PEitherData a b)) -> (PEitherData a b s -> Term s b0) -> Term s b0 Source # | |||||
| PlutusType (DeriveBuiltinPLiftable a h) Source # | |||||
Defined in Plutarch.Internal.Lift Associated Types
Methods pcon' :: forall (s :: S). DeriveBuiltinPLiftable a h s -> Term s (PInner (DeriveBuiltinPLiftable a h)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveBuiltinPLiftable a h)) -> (DeriveBuiltinPLiftable a h s -> Term s b) -> Term s b Source # | |||||
| PlutusType (DeriveDataPLiftable a h) Source # | |||||
Defined in Plutarch.Internal.Lift Associated Types
Methods pcon' :: forall (s :: S). DeriveDataPLiftable a h s -> Term s (PInner (DeriveDataPLiftable a h)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveDataPLiftable a h)) -> (DeriveDataPLiftable a h s -> Term s b) -> Term s b Source # | |||||
| PlutusType (DeriveNewtypePLiftable wrapper h) Source # | |||||
Defined in Plutarch.Internal.Lift Associated Types
Methods pcon' :: forall (s :: S). DeriveNewtypePLiftable wrapper h s -> Term s (PInner (DeriveNewtypePLiftable wrapper h)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveNewtypePLiftable wrapper h)) -> (DeriveNewtypePLiftable wrapper h s -> Term s b) -> Term s b Source # | |||||
| PlutusType (PForall f) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType (PSome f) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType (PScottEncoded a r) Source # | |||||
Defined in Plutarch.Internal.ScottEncoding Associated Types
Methods pcon' :: forall (s :: S). PScottEncoded a r s -> Term s (PInner (PScottEncoded a r)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PScottEncoded a r)) -> (PScottEncoded a r s -> Term s b) -> Term s b Source # | |||||
| PlutusType (a :--> b) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| PlutusType (PPair a b) Source # | |||||
Defined in Plutarch.Pair Associated Types
| |||||
| PlutusType (DerivePLiftableAsRepr wrapper h) Source # | |||||
Defined in Plutarch.Repr.Derive Associated Types
Methods pcon' :: forall (s :: S). DerivePLiftableAsRepr wrapper h s -> Term s (PInner (DerivePLiftableAsRepr wrapper h)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DerivePLiftableAsRepr wrapper h)) -> (DerivePLiftableAsRepr wrapper h s -> Term s b) -> Term s b Source # | |||||
pcon :: forall a (s :: S). PlutusType a => a s -> Term s a Source #
Construct a Plutarch Term via a Haskell datatype
pmatch :: forall a (s :: S) (b :: S -> Type). PlutusType a => Term s a -> (a s -> Term s b) -> Term s b Source #
Pattern match over Plutarch Terms via a Haskell datatype
data PlutusTypeNewtype Source #
Instances
| PlutusTypeStrat PlutusTypeNewtype Source # | |||||||||
Defined in Plutarch.Internal.Newtype Associated Types
Methods derivedPCon :: forall a (s :: S). (DerivePlutusType a, DPTStrat a ~ PlutusTypeNewtype) => a s -> Term s (DerivedPInner PlutusTypeNewtype a) Source # derivedPMatch :: forall a (s :: S) (b :: S -> Type). (DerivePlutusType a, DPTStrat a ~ PlutusTypeNewtype) => Term s (DerivedPInner PlutusTypeNewtype a) -> (a s -> Term s b) -> Term s b Source # | |||||||||
| type PlutusTypeStratConstraint PlutusTypeNewtype Source # | |||||||||
Defined in Plutarch.Internal.Newtype | |||||||||
| type DerivedPInner PlutusTypeNewtype a Source # | |||||||||
Defined in Plutarch.Internal.Newtype | |||||||||
data PlutusTypeScott Source #
Instances
| PlutusTypeStrat PlutusTypeScott Source # | |||||||||
Defined in Plutarch.Internal.ScottEncoding Associated Types
Methods derivedPCon :: forall a (s :: S). (DerivePlutusType a, DPTStrat a ~ PlutusTypeScott) => a s -> Term s (DerivedPInner PlutusTypeScott a) Source # derivedPMatch :: forall a (s :: S) (b :: S -> Type). (DerivePlutusType a, DPTStrat a ~ PlutusTypeScott) => Term s (DerivedPInner PlutusTypeScott a) -> (a s -> Term s b) -> Term s b Source # | |||||||||
| type PlutusTypeStratConstraint PlutusTypeScott Source # | |||||||||
Defined in Plutarch.Internal.ScottEncoding | |||||||||
| type DerivedPInner PlutusTypeScott a Source # | |||||||||
Defined in Plutarch.Internal.ScottEncoding | |||||||||
newtype DeriveNewtypePlutusType (a :: S -> Type) (s :: S) Source #
Since: 1.10.0
Constructors
| DeriveNewtypePlutusType (a s) |
Instances
| (pt ~ UnTermSingle (Head (Head (Code (a (Any :: S))))), forall (s :: S). H s a pt) => PlutusType (DeriveNewtypePlutusType a) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). DeriveNewtypePlutusType a s -> Term s (PInner (DeriveNewtypePlutusType a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveNewtypePlutusType a)) -> (DeriveNewtypePlutusType a s -> Term s b) -> Term s b Source # | |||||
| type PInner (DeriveNewtypePlutusType a) Source # | |||||
Defined in Plutarch.Internal.PlutusType | |||||
newtype DeriveFakePlutusType (a :: S -> Type) (s :: S) Source #
This is a cursed derivation strategy that will give you PlutusType with no questions asked. This is occasionally helpful
for deriving PlutusType for another derivation strategy wrapper whose target instance requires PlutusType as superclass.
See PLiftable
Constructors
| DeriveFakePlutusType (a s) |
Instances
| PlutusType (DeriveFakePlutusType a) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
Methods pcon' :: forall (s :: S). DeriveFakePlutusType a s -> Term s (PInner (DeriveFakePlutusType a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (DeriveFakePlutusType a)) -> (DeriveFakePlutusType a s -> Term s b) -> Term s b Source # | |||||
| type PInner (DeriveFakePlutusType a) Source # | |||||
Defined in Plutarch.Internal.PlutusType | |||||
Numeric
Since: 1.10.0
Instances
| Arbitrary Positive Source # | Since: 1.10.0 |
| CoArbitrary Positive Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods coarbitrary :: Positive -> Gen b -> Gen b | |
| Function Positive Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric | |
| Show Positive Source # | Since: 1.10.0 |
| Eq Positive Source # | Since: 1.10.0 |
| Ord Positive Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric | |
| Pretty Positive Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric | |
data PPositive (s :: S) Source #
Since: 1.10.0
Instances
| PCountable PPositive Source # | Since: 1.10.0 | ||||||||
| PEq PPositive Source # | Since: 1.10.0 | ||||||||
| PIsData PPositive Source # | Since: 1.10.0 | ||||||||
| PLiftable PPositive Source # | |||||||||
Defined in Plutarch.Internal.Numeric Associated Types
Methods haskToRepr :: AsHaskell PPositive -> PlutusRepr PPositive Source # reprToHask :: PlutusRepr PPositive -> Either LiftError (AsHaskell PPositive) Source # reprToPlut :: forall (s :: S). PlutusRepr PPositive -> PLifted s PPositive Source # plutToRepr :: (forall (s :: S). PLifted s PPositive) -> Either LiftError (PlutusRepr PPositive) Source # | |||||||||
| PAdditiveSemigroup PPositive Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeMonoid PPositive Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeSemigroup PPositive Source # | Since: 1.10.0 | ||||||||
| POrd PPositive Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric Methods (#<=) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source # (#<) :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PBool Source # pmax :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PPositive Source # pmin :: forall (s :: S). Term s PPositive -> Term s PPositive -> Term s PPositive Source # | |||||||||
| PValidateData PPositive Source # | Checks that we have a positive Since: 1.13.0 | ||||||||
| PlutusType PPositive Source # | |||||||||
Defined in Plutarch.Internal.Numeric Associated Types
| |||||||||
| PShow PPositive Source # | Since: 1.10.0 | ||||||||
| PTryFrom PInteger PPositive Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| PTryFrom PData (PAsData PPositive) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| Generic (PPositive s) Source # | |||||||||
Defined in Plutarch.Internal.Numeric Associated Types
| |||||||||
| Generic (PPositive s) Source # | |||||||||
| type AsHaskell PPositive Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type PlutusRepr PPositive Source # | |||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type PInner PPositive Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type PTryFromExcess PInteger PPositive Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type PTryFromExcess PData (PAsData PPositive) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type Rep (PPositive s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type Code (PPositive s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
data PNatural (s :: S) Source #
Since: 1.10.0
Instances
| PEq PNatural Source # | Since: 1.10.0 | ||||||||
| PIsData PNatural Source # | Since: 1.10.0 | ||||||||
| PLiftable PNatural Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric Associated Types
Methods haskToRepr :: AsHaskell PNatural -> PlutusRepr PNatural Source # reprToHask :: PlutusRepr PNatural -> Either LiftError (AsHaskell PNatural) Source # reprToPlut :: forall (s :: S). PlutusRepr PNatural -> PLifted s PNatural Source # plutToRepr :: (forall (s :: S). PLifted s PNatural) -> Either LiftError (PlutusRepr PNatural) Source # | |||||||||
| PAdditiveMonoid PNatural Source # | Since: 1.10.0 | ||||||||
| PAdditiveSemigroup PNatural Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeMonoid PNatural Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeSemigroup PNatural Source # | Since: 1.10.0 | ||||||||
| POrd PNatural Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric Methods (#<=) :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PBool Source # (#<) :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PBool Source # pmax :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PNatural Source # pmin :: forall (s :: S). Term s PNatural -> Term s PNatural -> Term s PNatural Source # | |||||||||
| PlutusType PNatural Source # | |||||||||
Defined in Plutarch.Internal.Numeric Associated Types
| |||||||||
| PShow PNatural Source # | Since: 1.13.0 | ||||||||
| PTryFrom PData (PAsData PNatural) Source # | Since: 3.4.0 | ||||||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||||||
| Generic (PNatural s) Source # | |||||||||
Defined in Plutarch.Internal.Numeric Associated Types
| |||||||||
| Generic (PNatural s) Source # | |||||||||
| type AsHaskell PNatural Source # | |||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type PlutusRepr PNatural Source # | |||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type PInner PNatural Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type PTryFromExcess PData (PAsData PNatural) Source # | |||||||||
Defined in Plutarch.Internal.TryFrom | |||||||||
| type Rep (PNatural s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
| type Code (PNatural s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Numeric | |||||||||
class PAdditiveSemigroup (a :: S -> Type) where Source #
The addition operation, and the notion of scaling by a positive.
Laws
x #+ y=y #+ x(commutativity of#+)x #+ (y #+ z)=(x #+ y) #+ z(associativity of#+)
If you define a custom pscalePositive, ensure the following also hold:
pscalePositive x pone=x(pscalePositive x n) #+ (pscalePositive x m)=pscalePositive x (n #+ m)pscalePositive (pscalePositive x n) m=pscalePositive x (n #* m)
The default implementation ensures these laws are satisfied.
Since: 1.10.0
Minimal complete definition
Nothing
Methods
(#+) :: forall (s :: S). Term s a -> Term s a -> Term s a infix 6 Source #
default (#+) :: forall (s :: S). PAdditiveSemigroup (PInner a) => Term s a -> Term s a -> Term s a Source #
pscalePositive :: forall (s :: S). Term s a -> Term s PPositive -> Term s a Source #
This defaults to exponentiation-by-squaring, which in general is the best we can do.
Instances
| PAdditiveSemigroup PBuiltinBLS12_381_G1_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods (#+) :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element Source # pscalePositive :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element -> Term s PPositive -> Term s PBuiltinBLS12_381_G1_Element Source # | |
| PAdditiveSemigroup PBuiltinBLS12_381_G2_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods (#+) :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element Source # pscalePositive :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element -> Term s PPositive -> Term s PBuiltinBLS12_381_G2_Element Source # | |
| PAdditiveSemigroup PInteger Source # | Since: 1.10.0 |
| PAdditiveSemigroup PNatural Source # | Since: 1.10.0 |
| PAdditiveSemigroup PPositive Source # | Since: 1.10.0 |
| PAdditiveSemigroup PRational Source # | Since: 1.10.0 |
| PAdditiveSemigroup a => PAdditiveSemigroup (PPullArray a) Source # | Since: 1.12.0 |
Defined in Plutarch.Array Methods (#+) :: forall (s :: S). Term s (PPullArray a) -> Term s (PPullArray a) -> Term s (PPullArray a) Source # pscalePositive :: forall (s :: S). Term s (PPullArray a) -> Term s PPositive -> Term s (PPullArray a) Source # | |
class PAdditiveSemigroup a => PAdditiveMonoid (a :: S -> Type) where Source #
The notion of zero, as well as a way to scale by naturals.
Laws
pzero #+ x=x(pzerois the identity of#+)pscalePositive pzero n=pzero(pzerodoes not scale up)
If you define pscaleNatural, ensure the following as well:
pscaleNatural x (ppositiveToNatural # p)=pscalePositive x ppscaleNatural x pzero=pzero
The default implementation of pscaleNatural ensures these laws hold.
Since: 1.10.0
Minimal complete definition
Nothing
Methods
pzero :: forall (s :: S). Term s a Source #
pscaleNatural :: forall (s :: S). Term s a -> Term s PNatural -> Term s a Source #
Instances
| PAdditiveMonoid PBuiltinBLS12_381_G1_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods pzero :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element Source # pscaleNatural :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element -> Term s PNatural -> Term s PBuiltinBLS12_381_G1_Element Source # | |
| PAdditiveMonoid PBuiltinBLS12_381_G2_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods pzero :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element Source # pscaleNatural :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element -> Term s PNatural -> Term s PBuiltinBLS12_381_G2_Element Source # | |
| PAdditiveMonoid PInteger Source # | Since: 1.10.0 |
| PAdditiveMonoid PNatural Source # | Since: 1.10.0 |
| PAdditiveMonoid PRational Source # | Since: 1.10.0 |
class PAdditiveMonoid a => PAdditiveGroup (a :: S -> Type) where Source #
The notion of additive inverses, and the subtraction operation.
Laws
If you define pnegate, the following laws must hold:
(pnegate # x) #+ x=pzero(pnegateis an additive inverse)pnegate #$ pnegate # x=x(pnegateis self-inverting)
If you define #-, the following law must hold:
x #- x=pzero
Additionally, the following 'consistency laws' must hold. Default
implementations of both pnegate and #- uphold these.
pnegate # x=pzero #- xx #- y=x #+ (pnegate # y)
Lastly, if you define a custom pscaleInteger, the following laws
must hold:
pscaleInteger x pzero=pzeropscaleInteger x (pnegate # y)=pnegate # (pscaleInteger x y)
Since: 1.10.0
Methods
pnegate :: forall (s :: S). Term s (a :--> a) Source #
(#-) :: forall (s :: S). Term s a -> Term s a -> Term s a infix 6 Source #
pscaleInteger :: forall (s :: S). Term s a -> Term s PInteger -> Term s a Source #
Instances
| PAdditiveGroup PBuiltinBLS12_381_G1_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods pnegate :: forall (s :: S). Term s (PBuiltinBLS12_381_G1_Element :--> PBuiltinBLS12_381_G1_Element) Source # (#-) :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element Source # pscaleInteger :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element -> Term s PInteger -> Term s PBuiltinBLS12_381_G1_Element Source # | |
| PAdditiveGroup PBuiltinBLS12_381_G2_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods pnegate :: forall (s :: S). Term s (PBuiltinBLS12_381_G2_Element :--> PBuiltinBLS12_381_G2_Element) Source # (#-) :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element Source # pscaleInteger :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element -> Term s PInteger -> Term s PBuiltinBLS12_381_G2_Element Source # | |
| PAdditiveGroup PInteger Source # | Since: 1.10.0 |
| PAdditiveGroup PRational Source # | Since: 1.10.0 |
class PMultiplicativeSemigroup (a :: S -> Type) where Source #
The multiplication operation.
Laws
x #* (y #* z)=(x #* y) #* z(associativity of#*)
If you define a custom ppowPositive, ensure the following also hold:
ppowPositive x pone=x(ppowPositive x n) #* (ppowPositive x m)=ppowPositive x (n #+ m)ppowPositive (ppowPositive x n) m=ppowPositive x (n #* m)
The default implementation ensures these laws are satisfied.
Note
Unlike PAdditiveSemigroup, the multiplication operation doesn't need to be
commutative. Currently, all Plutarch-provided instances are, but this need
not be true for other instances.
Since: 1.10.0
Minimal complete definition
Nothing
Methods
(#*) :: forall (s :: S). Term s a -> Term s a -> Term s a infix 6 Source #
default (#*) :: forall (s :: S). PMultiplicativeSemigroup (PInner a) => Term s a -> Term s a -> Term s a Source #
ppowPositive :: forall (s :: S). Term s a -> Term s PPositive -> Term s a Source #
Instances
| PMultiplicativeSemigroup PBuiltinBLS12_381_MlResult Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Numeric Methods (#*) :: forall (s :: S). Term s PBuiltinBLS12_381_MlResult -> Term s PBuiltinBLS12_381_MlResult -> Term s PBuiltinBLS12_381_MlResult Source # ppowPositive :: forall (s :: S). Term s PBuiltinBLS12_381_MlResult -> Term s PPositive -> Term s PBuiltinBLS12_381_MlResult Source # | |
| PMultiplicativeSemigroup PInteger Source # | Since: 1.10.0 |
| PMultiplicativeSemigroup PNatural Source # | Since: 1.10.0 |
| PMultiplicativeSemigroup PPositive Source # | Since: 1.10.0 |
| PMultiplicativeSemigroup PRational Source # | Since: 1.10.0 |
| PMultiplicativeSemigroup a => PMultiplicativeSemigroup (PPullArray a) Source # | Since: 1.12.0 |
Defined in Plutarch.Array Methods (#*) :: forall (s :: S). Term s (PPullArray a) -> Term s (PPullArray a) -> Term s (PPullArray a) Source # ppowPositive :: forall (s :: S). Term s (PPullArray a) -> Term s PPositive -> Term s (PPullArray a) Source # | |
class PMultiplicativeSemigroup a => PMultiplicativeMonoid (a :: S -> Type) where Source #
The notion of one (multiplicative identity), and exponentiation by - naturals.
Laws
pone #* x=x(poneis the left identity of#*)x #* pone=x(poneis the right identity of#*)ppowPositive pone p=pone(ponedoes not scale up)
If you define ppowNatural, ensure the following as well:
ppowNatural x (ppositiveToNatural # p)=ppowPositive x pppowNatural x pzero=pone
Since: 1.10.0
Minimal complete definition
Nothing
Methods
pone :: forall (s :: S). Term s a Source #
ppowNatural :: forall (s :: S). Term s a -> Term s PNatural -> Term s a Source #
Instances
| PMultiplicativeMonoid PInteger Source # | Since: 1.10.0 |
| PMultiplicativeMonoid PNatural Source # | Since: 1.10.0 |
| PMultiplicativeMonoid PPositive Source # | Since: 1.10.0 |
| PMultiplicativeMonoid PRational Source # | Since: 1.10.0 |
class (PAdditiveGroup a, PMultiplicativeMonoid a) => PRing (a :: S -> Type) where Source #
Laws
pfromInteger 0=pzeropfromInteger 1=ponepfromInteger (x + y)=pfromInteger x #+ pfromInteger ypfromInteger (x * y)=pfromInteger x #* pfromInteger y
Additionally, the following 'interaction laws' must hold between the
instances of PAdditiveGroup and PMultiplicativeMonoid for a:
x #* (y #+ z)=(x #* y) #+ (x #* z)(#*left-distributes over#+)(y #+ z) #* x=(y #* x) #+ (z #* x)(#*right-distributes over#+)
Since: 1.10.0
Minimal complete definition
Nothing
Instances
class (PRing a, POrd a) => PIntegralDomain (a :: S -> Type) where Source #
Laws
Pedantry note
Technically, the requirements here are too strong: we demand an ordered ring, which integral domains don't necessarily have to be. However, in our case, our hand is forced by expected semantics: in abstract algebra, both the absolute value and the signum are real numbers (which are always totally ordered) but in our case, both must be elements of the integral domain itself. Thus, in order for the laws to make any sense, we have to ensure a total order on the integral domain. Since all of our integral domains are 'at least as big' as the integers, this doesn't pose a huge problem.
Since: 1.10.0
Minimal complete definition
Nothing
Instances
| PIntegralDomain PInteger Source # | Since: 1.10.0 |
| PIntegralDomain PRational Source # | Since: 1.10.0 |
ptryPositive :: forall (s :: S). Term s (PInteger :--> PPositive) Source #
Partial version of ppositive. Errors if argument is not positive.
Since: 1.10.0
ptryNatural :: forall (s :: S). Term s (PInteger :--> PNatural) Source #
Partial version of pnatural. Errors if argument is negative.
Since: 1.10.0
ppositiveToNatural :: forall (s :: S). Term s (PPositive :--> PNatural) Source #
'Relax' a PPositive to PNatural. This uses punsafeCoerce
underneath, but because any positive is also a natural, is safe.
Since: 1.10.0
Other
pinl :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s a -> (Term s a -> Term s b) -> Term s b Source #
plam :: forall (c :: S -> Type). (PLamN a b s, HasCallStack) => (Term s c -> a) -> Term s (c :--> b) Source #
newtype PForall (b :: a -> S -> Type) (s :: S) Source #
Instances
| PlutusType (PForall f) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| type PInner (PForall f) Source # | |||||
Defined in Plutarch.Internal.PlutusType | |||||
Show
class PShow (t :: S -> Type) where Source #
Allows a debugging representation of the datatype as a PString.
Important note
Use of PShow in production scripts is not a good idea, as it requires
considerable script budget, especially for larger or more complex values. In
general, this type class is provided to assist with testing or debugging: be
very careful when using it for anything else, lest it impact your
performance.
Writing manual instances of this type class is also discouraged, as it is not
intended to be a pretty printer. In most situations, the Generic-based
derivation of instances for this type class is what you want.
Minimal complete definition
Nothing
Methods
pshow' :: forall (s :: S). Bool -> Term s t -> Term s PString Source #
Return the PString representation of a Plutarch value.
If the argument is True, wrap the output in `(..)` if it represents multiple parameters.
Since: 1.13.0
Instances
| PShow PBool Source # | |
| PShow PByteString Source # | |
Defined in Plutarch.Internal.Show | |
| PShow PData Source # | |
| PShow PInteger Source # | |
| PShow PString Source # | |
| PShow PUnit Source # | |
| PShow PNatural Source # | Since: 1.13.0 |
| PShow PPositive Source # | Since: 1.10.0 |
| PShow PRational Source # | |
| (PIsData a, PShow a) => PShow (PAsData a) Source # | |
| (PShow a, Contains DefaultUni (PlutusRepr a)) => PShow (PBuiltinList a) Source # | |
Defined in Plutarch.Internal.Show | |
| (All (Top :: PLabeledType -> Constraint) xs, KnownSymbol label, PIsData x, PShow x, PShow (PDataRecordShowHelper xs)) => PShow (PDataRecord ((label ':= x) ': xs)) Source # | |
| PShow (PDataRecord ('[] :: [PLabeledType])) Source # | |
Defined in Plutarch.DataRepr.Internal Methods pshow' :: forall (s :: S). Bool -> Term s (PDataRecord ('[] :: [PLabeledType])) -> Term s PString Source # | |
| (All (Top :: [PLabeledType] -> Constraint) defs, All (Compose PShow PDataRecord) defs) => PShow (PDataSum defs) Source # | |
| PShow a => PShow (PList a) Source # | |
| PShow a => PShow (PMaybe a) Source # | Since: 1.10.0 |
| (PShow a, PShow b) => PShow (PBuiltinPair a b) Source # | |
Defined in Plutarch.Internal.Show | |
| (PShow a, PShow b) => PShow (PEither a b) Source # | Since: 1.10.0 |
| (PIsData a, PIsData b, PShow a, PShow b) => PShow (PEitherData a b) Source # | Since: 1.10.0 |
Defined in Plutarch.Either | |
| (PShow a, PShow b) => PShow (PPair a b) Source # | Since: 1.10.0 |
pshow :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s PString Source #
Return the string representation of a Plutarch value
Term and related functionality
data Term (s :: S) (a :: S -> Type) Source #
Instances
| (IndexLabel name as ~ a, ElemOf name a as, Term s (PAsData b) ~ a, PFromDataable b c) => HasField (name :: Symbol) (HRec as) (Term s c) Source # | |
| IsString (Term s PString) Source # | |
Defined in Plutarch.Builtin.String | |
| Monoid (Term s PByteString) Source # | |
Defined in Plutarch.Builtin.ByteString Methods mempty :: Term s PByteString Source # mappend :: Term s PByteString -> Term s PByteString -> Term s PByteString Source # mconcat :: [Term s PByteString] -> Term s PByteString Source # | |
| Monoid (Term s PString) Source # | |
| Monoid (Term s PUnit) Source # | |
| Semigroup (Term s PByteString) Source # | |
Defined in Plutarch.Builtin.ByteString Methods (<>) :: Term s PByteString -> Term s PByteString -> Term s PByteString Source # sconcat :: NonEmpty (Term s PByteString) -> Term s PByteString Source # stimes :: Integral b => b -> Term s PByteString -> Term s PByteString Source # | |
| Semigroup (Term s PString) Source # | |
| Semigroup (Term s PUnit) Source # | |
| PIntegralDomain a => Num (Term s a) Source # | |
Defined in Plutarch.Internal.Numeric Methods (+) :: Term s a -> Term s a -> Term s a Source # (-) :: Term s a -> Term s a -> Term s a Source # (*) :: Term s a -> Term s a -> Term s a Source # negate :: Term s a -> Term s a Source # abs :: Term s a -> Term s a Source # signum :: Term s a -> Term s a Source # fromInteger :: Integer -> Term s a Source # | |
| Fractional (Term s PRational) Source # | Since: 1.10.0 |
Instances
| UnsafeConstrNP ('[] :: [S -> Type]) Source # | |
| UnsafeConstrNP xs => UnsafeConstrNP (x ': xs) Source # | |
papp :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (a :--> b) -> Term s a -> Term s b Source #
Lambda Application.
pdelay :: forall (s :: S) (a :: S -> Type). Term s a -> Term s (PDelayed a) Source #
Plutus 'delay', used for laziness.
pforce :: forall (s :: S) (a :: S -> Type). Term s (PDelayed a) -> Term s a Source #
Plutus 'force',
used to force evaluation of PDelayed terms.
perror :: forall (s :: S) (a :: S -> Type). Term s a Source #
Plutus 'error'.
When using this explicitly, it should be ensured that the containing term is delayed, avoiding premature evaluation.
phoistAcyclic :: forall (a :: S -> Type) (s :: S). HasCallStack => (forall (s' :: S). Term s' a) -> Term s a Source #
plet :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s a -> (Term s a -> Term s b) -> Term s b Source #
Let bindings.
This is approximately a shorthand for a lambda and application:
plet v f == papp (plam f) v
But sufficiently small terms in WHNF may be inlined for efficiency.
(#) :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (a :--> b) -> Term s a -> Term s b infixl 8 Source #
High precedence infixl synonym of papp, to be used like
function juxtaposition. e.g.:
>>>f # x # yf x y
(#$) :: forall (s :: S) (a :: S -> Type) (b :: S -> Type). Term s (a :--> b) -> Term s a -> Term s b infixr 0 Source #
data ((a :: S -> Type) :--> (b :: S -> Type)) (s :: S) infixr 0 Source #
Instances
| PlutusType (a :--> b) Source # | |||||
Defined in Plutarch.Internal.PlutusType Associated Types
| |||||
| (a' ~ Term s a, PLamN b' b s) => PLamN (a' -> b') (a :--> b) s Source # | |||||
| type PInner (a :--> b) Source # | |||||
Defined in Plutarch.Internal.PlutusType | |||||
Conversion
type family PSubtype (a :: S -> Type) (b :: S -> Type) where ... Source #
Equations
| PSubtype a b = (PSubtype' a b ~ 'PSubtypeRelation, PSubtypeHelper a b (PSubtype' a b)) |
class PSubtype a b => PTryFrom (a :: S -> Type) (b :: S -> Type) where Source #
PTryFrom a b represents a subtyping relationship between a and b,
and a way to go from a to b.
Laws:
- (punsafeCoerce . fst) $ tcont (ptryFrom x) ≡ pure x
Minimal complete definition
Nothing
Associated Types
type PTryFromExcess (a :: S -> Type) (b :: S -> Type) :: S -> Type Source #
type PTryFromExcess (a :: S -> Type) (b :: S -> Type) = PTryFromExcess a (PInner b)
Methods
ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r Source #
Instances
| PTryFrom PData PData Source # | |||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PInteger PPositive Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PData (PAsData PBool) Source # | Since: 1.7.0 | ||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PData (PAsData PByteString) Source # | |||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| (PTryFrom PData (PAsData a), PIsData a) => PTryFrom PData (PAsData (PBuiltinList (PAsData a))) Source # | Recover a `PBuiltinList (PAsData a)` | ||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PData (PAsData (PBuiltinList PData)) Source # | This verifies a list to be indeed a list but doesn't recover the inner data use this instance instead of the one for `PData (PAsData (PBuiltinList (PAsData a)))` as this is O(1) instead of O(n) | ||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| (PTryFrom PData a, a ~ PAsData a', PIsData a', PTryFrom PData b, b ~ PAsData b', PIsData b') => PTryFrom PData (PAsData (PBuiltinPair a b)) Source # | Recover a `PAsData (PBuiltinPair a b)` | ||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PData (PAsData PData) Source # | |||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PData (PAsData PInteger) Source # | |||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| (PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom PData (PAsData (PDataRecord as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| PTryFrom PData (PDataSum ys) => PTryFrom PData (PAsData (PDataSum ys)) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| (PTryFrom PData a, PTryFrom PData b) => PTryFrom PData (PAsData (PEitherData a b)) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Either Associated Types
| |||||
| PTryFrom PData (PAsData PNatural) Source # | Since: 3.4.0 | ||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PData (PAsData PPositive) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Internal.TryFrom Associated Types
| |||||
| PTryFrom PData (PAsData PRational) Source # | NOTE: This instance produces a verified | ||||
Defined in Plutarch.Rational Associated Types
| |||||
| SumValidation 0 ys => PTryFrom PData (PDataSum ys) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
| |||||
| (PTryFrom PData a, PTryFrom PData b) => PTryFrom PData (PEitherData a b) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Either Associated Types
| |||||
| (Helper2 (PSubtype' PData pty) pty, PTryFrom (PBuiltinList PData) (PDataRecord as), PTryFromExcess (PBuiltinList PData) (PDataRecord as) ~ HRecP ase) => PTryFrom (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ((name ':= pty) ': as)), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) s)) -> Term s r) -> Term s r Source # | |||||
| PTryFrom (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) Source # | |||||
Defined in Plutarch.DataRepr.Internal Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s (PBuiltinList PData) -> ((Term s (PDataRecord ('[] :: [PLabeledType])), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord ('[] :: [PLabeledType])) s)) -> Term s r) -> Term s r Source # | |||||
ptryFrom :: forall (b :: S -> Type) (a :: S -> Type) (s :: S) (r :: S -> Type). PTryFrom a b => Term s a -> ((Term s b, Reduce (PTryFromExcess a b s)) -> Term s r) -> Term s r Source #
pupcast :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). PSubtype a b => Term s b -> Term s a Source #
pto :: forall (a :: S -> Type) (s :: S). Term s a -> Term s (PInner a) Source #
Safely coerce from a Term to it's PInner representation.
Maybe
data PMaybe (a :: S -> Type) (s :: S) Source #
Since: 1.10.0
Instances
| PEq a => PEq (PMaybe a) Source # | Since: 1.10.0 | ||||||||
| PLiftable a => PLiftable (PMaybe a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Maybe Associated Types
Methods haskToRepr :: AsHaskell (PMaybe a) -> PlutusRepr (PMaybe a) Source # reprToHask :: PlutusRepr (PMaybe a) -> Either LiftError (AsHaskell (PMaybe a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PMaybe a) -> PLifted s (PMaybe a) Source # plutToRepr :: (forall (s :: S). PLifted s (PMaybe a)) -> Either LiftError (PlutusRepr (PMaybe a)) Source # | |||||||||
| PlutusType (PMaybe a) Source # | |||||||||
Defined in Plutarch.Maybe Associated Types
| |||||||||
| PShow a => PShow (PMaybe a) Source # | Since: 1.10.0 | ||||||||
| Generic (PMaybe a s) Source # | |||||||||
Defined in Plutarch.Maybe Associated Types
| |||||||||
| Generic (PMaybe a s) Source # | |||||||||
| type AsHaskell (PMaybe a) Source # | |||||||||
Defined in Plutarch.Maybe | |||||||||
| type PlutusRepr (PMaybe a) Source # | |||||||||
Defined in Plutarch.Maybe | |||||||||
| type PInner (PMaybe a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Maybe | |||||||||
| type Rep (PMaybe a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Maybe type Rep (PMaybe a s) = D1 ('MetaData "PMaybe" "Plutarch.Maybe" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'False) (C1 ('MetaCons "PJust" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a))) :+: C1 ('MetaCons "PNothing" 'PrefixI 'False) (U1 :: Type -> Type)) | |||||||||
| type Code (PMaybe a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Maybe | |||||||||
Pair
data PPair (a :: S -> Type) (b :: S -> Type) (s :: S) Source #
Plutus encoding of Pairs.
Note: This is represented differently than BuiltinPair. It is SoP encoded.
Instances
| (PEq a, PEq b) => PEq (PPair a b) Source # | Since: 1.10.0 | ||||
| PlutusType (PPair a b) Source # | |||||
Defined in Plutarch.Pair Associated Types
| |||||
| (PMonoid a, PMonoid b) => PMonoid (PPair a b) Source # | Since: 1.10.0 | ||||
| (PSemigroup a, PSemigroup b) => PSemigroup (PPair a b) Source # | Since: 1.10.0 | ||||
| (PShow a, PShow b) => PShow (PPair a b) Source # | Since: 1.10.0 | ||||
| Generic (PPair a b s) Source # | |||||
Defined in Plutarch.Pair Associated Types
| |||||
| Generic (PPair a b s) Source # | |||||
| type PInner (PPair a b) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Pair | |||||
| type Rep (PPair a b s) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Pair type Rep (PPair a b s) = D1 ('MetaData "PPair" "Plutarch.Pair" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'False) (C1 ('MetaCons "PPair" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s a)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s b)))) | |||||
| type Code (PPair a b s) Source # | Since: 1.10.0 | ||||
Defined in Plutarch.Pair | |||||
Rational
data PRational (s :: S) Source #
A Scott-encoded rational number, with a guaranteed positive denominator (and thus, a canonical form).
Note
This is not the Plutarch equivalent of a Plutus Rational; for this, you
want PRationalData from plutarch-ledger-api. PRational is designed to
optimize for computation: if you want to do any serious work with rational
numbers that isn't just passing them around, you want to use (or convert to)
PRational.
Instances
| PEq PRational Source # | |||||||||
| PLiftable PRational Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Rational Associated Types
Methods haskToRepr :: AsHaskell PRational -> PlutusRepr PRational Source # reprToHask :: PlutusRepr PRational -> Either LiftError (AsHaskell PRational) Source # reprToPlut :: forall (s :: S). PlutusRepr PRational -> PLifted s PRational Source # plutToRepr :: (forall (s :: S). PLifted s PRational) -> Either LiftError (PlutusRepr PRational) Source # | |||||||||
| PAdditiveGroup PRational Source # | Since: 1.10.0 | ||||||||
| PAdditiveMonoid PRational Source # | Since: 1.10.0 | ||||||||
| PAdditiveSemigroup PRational Source # | Since: 1.10.0 | ||||||||
| PIntegralDomain PRational Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeMonoid PRational Source # | Since: 1.10.0 | ||||||||
| PMultiplicativeSemigroup PRational Source # | Since: 1.10.0 | ||||||||
| PRing PRational Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Rational | |||||||||
| POrd PRational Source # | |||||||||
Defined in Plutarch.Rational Methods (#<=) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source # (#<) :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PBool Source # pmax :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PRational Source # pmin :: forall (s :: S). Term s PRational -> Term s PRational -> Term s PRational Source # | |||||||||
| PlutusType PRational Source # | |||||||||
Defined in Plutarch.Rational Associated Types
| |||||||||
| PShow PRational Source # | |||||||||
| PTryFrom PData (PAsData PRational) Source # | NOTE: This instance produces a verified | ||||||||
Defined in Plutarch.Rational Associated Types
| |||||||||
| Generic (PRational s) Source # | |||||||||
Defined in Plutarch.Rational Associated Types
| |||||||||
| Generic (PRational s) Source # | |||||||||
| Fractional (Term s PRational) Source # | Since: 1.10.0 | ||||||||
| type AsHaskell PRational Source # | |||||||||
Defined in Plutarch.Rational | |||||||||
| type PlutusRepr PRational Source # | |||||||||
Defined in Plutarch.Rational | |||||||||
| type PInner PRational Source # | |||||||||
Defined in Plutarch.Rational | |||||||||
| type PTryFromExcess PData (PAsData PRational) Source # | |||||||||
Defined in Plutarch.Rational | |||||||||
| type Rep (PRational s) Source # | |||||||||
Defined in Plutarch.Rational type Rep (PRational s) = D1 ('MetaData "PRational" "Plutarch.Rational" "plutarch-1.14.0-6fw3gqGsL7f3TFINWPu1lG" 'False) (C1 ('MetaCons "PRational" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PInteger)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s PPositive)))) | |||||||||
| type Code (PRational s) Source # | |||||||||
Defined in Plutarch.Rational | |||||||||
TermCont
newtype TermCont (a :: S) b where Source #
Constructors
| TermCont | |
Instances
| MonadFail (TermCont s) Source # | |
| Applicative (TermCont s) Source # | |
Defined in Plutarch.Internal.TermCont Methods pure :: a -> TermCont s a Source # (<*>) :: TermCont s (a -> b) -> TermCont s a -> TermCont s b Source # liftA2 :: (a -> b -> c) -> TermCont s a -> TermCont s b -> TermCont s c Source # (*>) :: TermCont s a -> TermCont s b -> TermCont s b Source # (<*) :: TermCont s a -> TermCont s b -> TermCont s a Source # | |
| Functor (TermCont s) Source # | |
| Monad (TermCont s) Source # | |
pguardC :: forall {r :: S -> Type} (s :: S). Term s PString -> Term s PBool -> TermCont s () Source #
Trace a message and raise error if cond is false. Otherwise, continue.
Example ===
onlyAllow42 :: Term s (PInteger :--> PUnit) onlyAllow42 = plam $ i -> unTermCont $ do pguardC "expected 42" $ i #== 42 pure $ pconstant ()
pguardC' :: forall (s :: S) (a :: S -> Type). Term s a -> Term s PBool -> TermCont s () Source #
Stop computation and return given term if cond is false. Otherwise, continue.
Example ===
is42 :: Term s (PInteger :--> PBool) is42 = plam $ i -> unTermCont $ do pguardC' (pconstant False) $ i #== 42 pure $ pconstant True
pletC :: forall {r :: S -> Type} (s :: S) (a :: S -> Type). Term s a -> TermCont s (Term s a) Source #
pletFieldsC :: forall (fs :: [Symbol]) (a :: S -> Type) (s :: S) (b :: S -> Type) (ps :: [PLabeledType]) (bs :: [ToBind]). (PDataFields a, ps ~ PFields a, bs ~ Bindings ps fs, BindFields ps bs) => Term s a -> TermCont s (HRec (BoundTerms ps bs s)) Source #
Deprecated: Use the new mechanism instead
Like pletFields but works in a TermCont monad.
pmatchC :: forall {r :: S -> Type} a (s :: S). PlutusType a => Term s a -> TermCont s (a s) Source #
ptraceC :: forall {r :: S -> Type} (s :: S). Term s PString -> TermCont s () Source #
Like ptrace but works in a TermCont monad.
Example ===
foo :: Term s PUnit foo = unTermCont $ do ptraceC "returning unit!" pure $ pconstant ()
ptryFromC :: forall (b :: S -> Type) (r :: S -> Type) (a :: S -> Type) (s :: S). PTryFrom a b => Term s a -> TermCont s (Term s b, Reduce (PTryFromExcess a b s)) Source #
Tracing
ptraceDebug :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a -> Term s a Source #
Trace the given message at the debug level before evaluating the given argument.
Since: 1.6.0
ptraceDebugError :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a Source #
Trace the given message at the debug level, then terminate with perror.
Since: 1.6.0
ptraceDebugIfFalse :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool Source #
Trace the given message at the debug level if the argument is false.
Since: 1.6.0
ptraceDebugIfTrue :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool Source #
Trace the given message at the debug level if the argument is true.
Since: 1.6.0
ptraceDebugShowId :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a Source #
Like Haskell's traceShowId but for Plutarch, at the debug level.
Since: 1.6.0
ptraceInfo :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a -> Term s a Source #
Trace the given message at the info level before evaluating the given argument.
Since: 1.6.0
ptraceInfoError :: forall (a :: S -> Type) (s :: S). Term s PString -> Term s a Source #
Trace the given message at the info level, then terminate with perror.
Since: 1.6.0
ptraceInfoIfFalse :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool Source #
Trace the given message at the info level if the argument is false.
Since: 1.6.0
ptraceInfoIfTrue :: forall (s :: S). Term s PString -> Term s PBool -> Term s PBool Source #
Trace the given message at the info level if the argument is true.
Since: 1.6.0
ptraceInfoShowId :: forall (a :: S -> Type) (s :: S). PShow a => Term s a -> Term s a Source #
Like Haskell's traceShowId but for Plutarch, at the info level.
Since: 1.6.0
Semigroup and Monoid
class PSemigroup (a :: S -> Type) where Source #
Laws
The only mandatory law is that #<> must be associative:
x #<> (y #<> z) = (x #<> y) #<> z
If you define pstimes, ensure the following also hold:
pstimes pone x=x(pstimes p1 x) #<> (pstimes p2 x)=pstimes (p1 #+ p2) xpstimes p1 (pstimes p2 x)=pstimes (p1 #* p2) x
The default implementation automatically ensures these laws hold.
Since: 1.10.0
Minimal complete definition
Nothing
Methods
(#<>) :: forall (s :: S). Term s a -> Term s a -> Term s a infixr 6 Source #
default (#<>) :: forall (s :: S). PSemigroup (PInner a) => Term s a -> Term s a -> Term s a Source #
pstimes :: forall (s :: S). Term s PPositive -> Term s a -> Term s a Source #
Instances
| PSemigroup PBitString Source # | Since: 1.10.0 |
Defined in Plutarch.BitString Methods (#<>) :: forall (s :: S). Term s PBitString -> Term s PBitString -> Term s PBitString Source # pstimes :: forall (s :: S). Term s PPositive -> Term s PBitString -> Term s PBitString Source # | |
| PSemigroup PBuiltinBLS12_381_G1_Element Source # | BLS points form a group technically, but a Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element Source # pstimes :: forall (s :: S). Term s PPositive -> Term s PBuiltinBLS12_381_G1_Element -> Term s PBuiltinBLS12_381_G1_Element Source # | |
| PSemigroup PBuiltinBLS12_381_G2_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element Source # pstimes :: forall (s :: S). Term s PPositive -> Term s PBuiltinBLS12_381_G2_Element -> Term s PBuiltinBLS12_381_G2_Element Source # | |
| PSemigroup PBuiltinBLS12_381_MlResult Source # | Since multiplication of Miller loop results exists, they are technically semigroups, though confusingly in a different way to BLS curve points. Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s PBuiltinBLS12_381_MlResult -> Term s PBuiltinBLS12_381_MlResult -> Term s PBuiltinBLS12_381_MlResult Source # pstimes :: forall (s :: S). Term s PPositive -> Term s PBuiltinBLS12_381_MlResult -> Term s PBuiltinBLS12_381_MlResult Source # | |
| PSemigroup PByteString Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s PByteString -> Term s PByteString -> Term s PByteString Source # pstimes :: forall (s :: S). Term s PPositive -> Term s PByteString -> Term s PByteString Source # | |
| PSemigroup PString Source # | Since: 1.10.0 |
| PSemigroup PUnit Source # | Since: 1.10.0 |
| PSemigroup (PAnd PBool) Source # | Since: 1.10.0 |
| PSemigroup (PAnd PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (PAnd PByteString) -> Term s (PAnd PByteString) -> Term s (PAnd PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (PAnd PByteString) -> Term s (PAnd PByteString) Source # | |
| PSemigroup (POr PBool) Source # | Since: 1.10.0 |
| PSemigroup (POr PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (POr PByteString) -> Term s (POr PByteString) -> Term s (POr PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (POr PByteString) -> Term s (POr PByteString) Source # | |
| PSemigroup (PXor PBool) Source # | Since: 1.10.0 |
| PSemigroup (PXor PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (PXor PByteString) -> Term s (PXor PByteString) -> Term s (PXor PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (PXor PByteString) -> Term s (PXor PByteString) Source # | |
| (PSemigroup a, PSemigroup b) => PSemigroup (PPair a b) Source # | Since: 1.10.0 |
class PSemigroup a => PMonoid (a :: S -> Type) where Source #
Laws
pmempty #<> x=x #<> pmempty=xpstimes n pmempty=pmempty
If you define pmtimes, ensure the following as well:
pmtimes (ppositiveToNatural # p) x=pstimes p xpmtimes pzero x=pmempty
The default implementation of pmtimes ensures these laws hold.
Since: 1.10.0
Minimal complete definition
Nothing
Methods
pmempty :: forall (s :: S). Term s a Source #
pmtimes :: forall (s :: S). Term s PNatural -> Term s a -> Term s a Source #
Instances
| PMonoid PBitString Source # | Since: 1.10.0 |
Defined in Plutarch.BitString | |
| PMonoid PBuiltinBLS12_381_G1_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup | |
| PMonoid PBuiltinBLS12_381_G2_Element Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup | |
| PMonoid PByteString Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup | |
| PMonoid PString Source # | Since: 1.10.0 |
| PMonoid PUnit Source # | Since: 1.10.0 |
| PMonoid (PAnd PBool) Source # | Since: 1.10.0 |
| PMonoid (PAnd PByteString) Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup | |
| PMonoid (POr PBool) Source # | Since: 1.10.0 |
| PMonoid (POr PByteString) Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup | |
| PMonoid (PXor PBool) Source # | Since: 1.10.0 |
| PMonoid (PXor PByteString) Source # | Since: 1.10.0 |
Defined in Plutarch.Internal.Semigroup | |
| (PMonoid a, PMonoid b) => PMonoid (PPair a b) Source # | Since: 1.10.0 |
newtype PAnd (a :: S -> Type) (s :: S) Source #
Wrapper for types which have logical AND semantics somehow.
Since: 1.10.0
Instances
| PEq a => PEq (PAnd a) Source # | Since: 1.10.0 | ||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PAnd a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
Methods haskToRepr :: AsHaskell (PAnd a) -> PlutusRepr (PAnd a) Source # reprToHask :: PlutusRepr (PAnd a) -> Either LiftError (AsHaskell (PAnd a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PAnd a) -> PLifted s (PAnd a) Source # plutToRepr :: (forall (s :: S). PLifted s (PAnd a)) -> Either LiftError (PlutusRepr (PAnd a)) Source # | |||||||||
| POrd a => POrd (PAnd a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<=) :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s (PAnd a) Source # pmin :: forall (s :: S). Term s (PAnd a) -> Term s (PAnd a) -> Term s (PAnd a) Source # | |||||||||
| PlutusType (PAnd a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||||||
| PMonoid (PAnd PBool) Source # | Since: 1.10.0 | ||||||||
| PMonoid (PAnd PByteString) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| PSemigroup (PAnd PBool) Source # | Since: 1.10.0 | ||||||||
| PSemigroup (PAnd PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (PAnd PByteString) -> Term s (PAnd PByteString) -> Term s (PAnd PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (PAnd PByteString) -> Term s (PAnd PByteString) Source # | |||||||||
| Generic (PAnd a s) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||||||
| Generic (PAnd a s) Source # | |||||||||
| type AsHaskell (PAnd a) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type PlutusRepr (PAnd a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type PInner (PAnd a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type Rep (PAnd a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type Code (PAnd a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
newtype POr (a :: S -> Type) (s :: S) Source #
Wrapper for types which have logical OR semantics somehow.
Since: 1.10.0
Instances
| PEq a => PEq (POr a) Source # | Since: 1.10.0 | ||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (POr a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
Methods haskToRepr :: AsHaskell (POr a) -> PlutusRepr (POr a) Source # reprToHask :: PlutusRepr (POr a) -> Either LiftError (AsHaskell (POr a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (POr a) -> PLifted s (POr a) Source # plutToRepr :: (forall (s :: S). PLifted s (POr a)) -> Either LiftError (PlutusRepr (POr a)) Source # | |||||||||
| POrd a => POrd (POr a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<=) :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s PBool Source # pmax :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s (POr a) Source # pmin :: forall (s :: S). Term s (POr a) -> Term s (POr a) -> Term s (POr a) Source # | |||||||||
| PlutusType (POr a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||||||
| PMonoid (POr PBool) Source # | Since: 1.10.0 | ||||||||
| PMonoid (POr PByteString) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| PSemigroup (POr PBool) Source # | Since: 1.10.0 | ||||||||
| PSemigroup (POr PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (POr PByteString) -> Term s (POr PByteString) -> Term s (POr PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (POr PByteString) -> Term s (POr PByteString) Source # | |||||||||
| Generic (POr a s) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||||||
| Generic (POr a s) Source # | |||||||||
| type AsHaskell (POr a) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type PlutusRepr (POr a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type PInner (POr a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type Rep (POr a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type Code (POr a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
newtype PXor (a :: S -> Type) (s :: S) Source #
Wrapper for types which have logical XOR semantics somehow.
Since: 1.10.0
Instances
| PEq a => PEq (PXor a) Source # | Since: 1.10.0 | ||||||||
| (PLiftable a, Includes DefaultUni (PlutusRepr a), KnownBuiltinType (Term DeBruijn DefaultUni DefaultFun ()) (PlutusRepr a)) => PLiftable (PXor a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
Methods haskToRepr :: AsHaskell (PXor a) -> PlutusRepr (PXor a) Source # reprToHask :: PlutusRepr (PXor a) -> Either LiftError (AsHaskell (PXor a)) Source # reprToPlut :: forall (s :: S). PlutusRepr (PXor a) -> PLifted s (PXor a) Source # plutToRepr :: (forall (s :: S). PLifted s (PXor a)) -> Either LiftError (PlutusRepr (PXor a)) Source # | |||||||||
| POrd a => POrd (PXor a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<=) :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s PBool Source # pmax :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s (PXor a) Source # pmin :: forall (s :: S). Term s (PXor a) -> Term s (PXor a) -> Term s (PXor a) Source # | |||||||||
| PlutusType (PXor a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||||||
| PMonoid (PXor PBool) Source # | Since: 1.10.0 | ||||||||
| PMonoid (PXor PByteString) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| PSemigroup (PXor PBool) Source # | Since: 1.10.0 | ||||||||
| PSemigroup (PXor PByteString) Source # | This uses padding semantics as specified in CIP-122, as this allows a
Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup Methods (#<>) :: forall (s :: S). Term s (PXor PByteString) -> Term s (PXor PByteString) -> Term s (PXor PByteString) Source # pstimes :: forall (s :: S). Term s PPositive -> Term s (PXor PByteString) -> Term s (PXor PByteString) Source # | |||||||||
| Generic (PXor a s) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup Associated Types
| |||||||||
| Generic (PXor a s) Source # | |||||||||
| type AsHaskell (PXor a) Source # | Since: 1.13.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type PlutusRepr (PXor a) Source # | |||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type PInner (PXor a) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type Rep (PXor a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
| type Code (PXor a s) Source # | Since: 1.10.0 | ||||||||
Defined in Plutarch.Internal.Semigroup | |||||||||
Unrolling utilities
punrollBound :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Integer -> Term s (a :--> b) -> (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b) Source #
This is simplified version of punrollBound' without doing additional recursion on Haskell level value.
Since: 1.10.0
punrollBound' :: forall (a :: S -> Type) (b :: S -> Type) c (s :: S). Integer -> (c -> Term s (a :--> b)) -> ((c -> Term s (a :--> b)) -> c -> Term s (a :--> b)) -> c -> Term s (a :--> b) Source #
The first argument specifies the unrolling depth. The second argument defines the fallback behavior when the recursion depth exceeds the provided unrolling depth.
The fixed-point implementation provided requires a Haskell-level value c and a Plutarch function of type `Term s (a :--> b)`. The functional for the recursion is passed as a Haskell function.
The inclusion of the additional, arbitrary Haskell value (typed c) enables further optimization by allowing pre-computation of constant values that depend only on the recursion depth.
This function will be used in a very niche situations. Using Haskell-level value for constant replacement is only practical on a single branch recursion with constant value that needs to be added
on each step. plength is one of the niche use case.
Since: 1.10.0
punrollUnbound :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Integer -> (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b) Source #
Unroll given amount of steps, and for rest, uses pfix to support unbound recursion.
Since: 1.10.0
punrollUnboundWhole :: forall (a :: S -> Type) (b :: S -> Type) (s :: S). Integer -> (Term s (a :--> b) -> Term s (a :--> b)) -> Term s (a :--> b) Source #
Validation
class PValidateData (a :: S -> Type) where Source #
Describes a Data encoded Plutarch type that requires some additional
validation to ensure its structure is indeed what we expect. This is
especially useful for datums or other user-supplied arguments, since these
can be malformed.
Why the CPS
pwithValidated is written in continuation-passing style (or CPS) for
reasons of efficiency. As pwithValidated is meant to check structure (and
nothing more), our first instinct would be to write something like
pwithValidated :: Term s PData -> Term s PBool
or
pwithValidated :: Term s PData -> Term s PUnit
and rely on perror to sort things out. However, constructing either PUnit
or PBool isn't free, and ultimately, this value ends up unused. At the same
time, we want to ensure that the validation specified in pwithValidated is
actually performed, which neither of the above signatures can promise
anything about.
CPS solves both of these problems. Since the result of pwithValidated is
technically a function that must behave the same no matter what type of r
it operates over, we can't do anything except potentially mess with the
argument PData or error out, which means we don't need to allocate any
'result value'. Furthermore, by working in CPS, we ensure that any
validation defined in pwithValidated must happen, even if the PData (or
whatever it's supposed to be) is never handled or forced.
Important note
It is essential practice to document what exactly any given instance of
PValidateData checks. Each instance should specify this: all the instances
provided by Plutarch and its related libraries follow this rule.
Since: 1.12.0
Methods
pwithValidated :: forall (s :: S). Term s PData -> forall (r :: S -> Type). Term s r -> Term s r Source #
Instances
| PValidateData PBool Source # | Checks that we have a Since: 1.12.0 |
| PValidateData PByteString Source # | Checks that we have a Since: 1.12.0 |
| PValidateData PData Source # | Checks (and does) nothing. Since: 1.12.0 |
| PValidateData PInteger Source # | Checks that we have an Since: 1.12.0 |
| PValidateData PPositive Source # | Checks that we have a positive Since: 1.13.0 |
| PValidateData a => PValidateData (PAsData a) Source # | Since: 1.12.0 |
| (PValidateData a, PValidateData b) => PValidateData (PBuiltinList (PBuiltinPair (PAsData a) (PAsData b))) Source # | Checks that we have a Since: 1.13.0 |
| PValidateData (PBuiltinList PData) Source # | Checks that we have a Since: 1.12.0 |
| PValidateData a => PValidateData (PBuiltinList a) Source # | Checks that we have a Since: 1.12.0 |
| PValidateData (Don'tValidate a) Source # | Since: 1.12.0 |
| (Generic (a (Any :: S)), All PInnermostIsDataDataRepr struct, struct ~ UnTermRec struct', Generic (a (Any :: S)), '[struct'] ~ Code (a (Any :: S)), All PValidateData struct, SListI struct) => PValidateData (DeriveAsDataRec a) Source # | Checks that we have a Since: 1.12.0 |
| (Generic (a (Any :: S)), struct ~ UnTermStruct (a (Any :: S)), All2 PInnermostIsDataDataRepr struct, All2 PValidateData struct, SListI2 struct) => PValidateData (DeriveAsDataStruct a) Source # | Checks that we have a Since: 1.12.0 |
| Generic (a (Any :: S)) => PValidateData (DeriveAsTag a) Source # | Checks that we have an Since: 1.12.0 |
| (PValidateData a, PValidateData b) => PValidateData (PBuiltinPair (PAsData a) (PAsData b)) Source # | Checks that we have a Since: 1.12.0 |
| PValidateData (PBuiltinPair PData PData) Source # | Checks that we have a Since: 1.12.0 |
| PValidateData b => PValidateData (DeriveNewtypePValidateData a b) Source # | Since: 1.12.0 |
newtype Don'tValidate (a :: S -> Type) (s :: S) Source #
Helper to define a do-nothing instance of PValidateData. Useful when
defining an instance for a complex type where we want to validate some parts,
but not others.
Since: 1.12.0
Constructors
| Don'tValidate | |
Fields
| |
Instances
| PValidateData (Don'tValidate a) Source # | Since: 1.12.0 | ||||
| PlutusType a => PlutusType (Don'tValidate a) Source # | Since: 1.12.0 | ||||
Defined in Plutarch.Internal.Parse Associated Types
Methods pcon' :: forall (s :: S). Don'tValidate a s -> Term s (PInner (Don'tValidate a)) Source # pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (Don'tValidate a)) -> (Don'tValidate a s -> Term s b) -> Term s b Source # | |||||
| type PInner (Don'tValidate a) Source # | |||||
Defined in Plutarch.Internal.Parse | |||||
newtype DeriveNewtypePValidateData (a :: S -> Type) (b :: S -> Type) (s :: S) Source #
Helper to define an instance of PValidateData for newtypes over
Terms, which 'borrows' the PValidateData instance for whatever the
newtype is wrapping.
Since: 1.12.0
Constructors
| DeriveNewtypePValidateData (a s) |
Instances
| PValidateData b => PValidateData (DeriveNewtypePValidateData a b) Source # | Since: 1.12.0 |
pparseData :: forall (a :: S -> Type) (s :: S). (PIsData a, PValidateData a) => Term s PData -> Term s (PAsData a) Source #
Given a PData, check that it is, indeed, structured as a expects. If it
is, return that same PData 'rewrapped' into PAsData a.
This helper exists to avoid having to work in CPS when writing regular code.
It is kept out of PValidateData for efficiency and safety reasons.
Since: 1.12.0