Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Value-related functionality. In order to keep the interface efficient and
safe at the same time, there is a type-level distinction between PValue
s
that are guaranteed to be properly normalized and those that provide no
such guarantee.
Also for efficiency reasons, the Ada-specific functions assume that there
can be only one token name for the Ada currency symbol, and they don't check
whether it matches adaToken
.
Synopsis
- newtype PValue (keys :: KeyGuarantees) (amounts :: AmountGuarantees) (s :: S) = PValue (Term s (PMap keys PCurrencySymbol (PMap keys PTokenName PInteger)))
- newtype PCurrencySymbol (s :: S) = PCurrencySymbol (Term s (PDataNewtype PByteString))
- newtype PTokenName (s :: S) = PTokenName (Term s (PDataNewtype PByteString))
- data AmountGuarantees
- newtype PLovelace (s :: S) = PLovelace (Term s (PDataNewtype PInteger))
- newtype PAssetClass (s :: S) = PAssetClass (Term s (PDataNewtype (PBuiltinPair (PAsData PCurrencySymbol) (PAsData PTokenName))))
- padaSymbol :: forall (s :: S). Term s PCurrencySymbol
- padaSymbolData :: forall (s :: S). Term s (PAsData PCurrencySymbol)
- padaToken :: Term s PTokenName
- psingleton :: forall (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> (PInteger :--> PValue 'Sorted 'NonZero)))
- psingletonData :: forall (s :: S). Term s (PAsData PCurrencySymbol :--> (PAsData PTokenName :--> (PAsData PInteger :--> PValue 'Sorted 'NonZero)))
- pconstantPositiveSingleton :: forall (s :: S). (forall (s' :: S). Term s' PCurrencySymbol) -> (forall (s' :: S). Term s' PTokenName) -> (forall (s' :: S). Term s' PInteger) -> Term s (PValue 'Sorted 'Positive)
- passertPositive :: forall (kg :: KeyGuarantees) (ag :: AmountGuarantees) (s :: S). Term s (PValue kg ag :--> PValue kg 'Positive)
- passertSorted :: forall (anyKey :: KeyGuarantees) (anyAmount :: AmountGuarantees) (s :: S). Term s (PValue anyKey anyAmount :--> PValue 'Sorted 'NonZero)
- pforgetPositive :: forall (a :: AmountGuarantees) (k :: KeyGuarantees) (s :: S). Term s (PValue k 'Positive) -> Term s (PValue k a)
- pforgetSorted :: forall (a :: AmountGuarantees) (k :: KeyGuarantees) (s :: S). Term s (PValue 'Sorted a) -> Term s (PValue k a)
- pnormalize :: forall (any :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted any :--> PValue 'Sorted 'NonZero)
- padaOnlyValue :: forall (v :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted v :--> PValue 'Sorted v)
- pnoAdaValue :: forall (v :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted v :--> PValue 'Sorted v)
- pcheckBinRel :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Term s ((PInteger :--> (PInteger :--> PBool)) :--> (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PBool)))
- pleftBiasedCurrencyUnion :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees))
- pleftBiasedTokenUnion :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees))
- punionResolvingCollisionsWith :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Commutativity -> Term s ((PInteger :--> (PInteger :--> PInteger)) :--> (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees)))
- punionResolvingCollisionsWithData :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Commutativity -> Term s ((PAsData PInteger :--> (PAsData PInteger :--> PAsData PInteger)) :--> (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees)))
- pvalueOf :: forall (anyKey :: KeyGuarantees) (anyAmount :: AmountGuarantees) (s :: S). Term s (PValue anyKey anyAmount :--> (PCurrencySymbol :--> (PTokenName :--> PInteger)))
- plovelaceValueOf :: forall (v :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted v :--> PInteger)
- pisAdaOnlyValue :: forall (s :: S). Term s (PValue 'Sorted 'Positive :--> PBool)
Types
newtype PValue (keys :: KeyGuarantees) (amounts :: AmountGuarantees) (s :: S) Source #
Since: 2.0.0
PValue (Term s (PMap keys PCurrencySymbol (PMap keys PTokenName PInteger))) |
Instances
PTryFrom PData (PAsData (PValue 'Sorted 'NoGuarantees)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData (PValue 'Sorted 'NoGuarantees)) :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s (PAsData (PValue 'Sorted 'NoGuarantees)), Reduce (PTryFromExcess PData (PAsData (PValue 'Sorted 'NoGuarantees)) s)) -> Term s r) -> Term s r | |
PTryFrom PData (PAsData (PValue 'Sorted 'NonZero)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
PTryFrom PData (PAsData (PValue 'Sorted 'Positive)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
PTryFrom PData (PAsData (PValue 'Unsorted 'NoGuarantees)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData (PValue 'Unsorted 'NoGuarantees)) :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s (PAsData (PValue 'Unsorted 'NoGuarantees)), Reduce (PTryFromExcess PData (PAsData (PValue 'Unsorted 'NoGuarantees)) s)) -> Term s r) -> Term s r | |
PTryFrom PData (PAsData (PValue 'Unsorted 'NonZero)) Source # | Since: 2.1.1 |
Defined in Plutarch.LedgerApi.Value | |
PTryFrom PData (PAsData (PValue 'Unsorted 'Positive)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
Semigroup (Term s (PValue 'Sorted normalization)) => Monoid (Term s (PValue 'Sorted normalization)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
Semigroup (Term s (PValue 'Sorted 'NoGuarantees)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (<>) :: Term s (PValue 'Sorted 'NoGuarantees) -> Term s (PValue 'Sorted 'NoGuarantees) -> Term s (PValue 'Sorted 'NoGuarantees) Source # sconcat :: NonEmpty (Term s (PValue 'Sorted 'NoGuarantees)) -> Term s (PValue 'Sorted 'NoGuarantees) Source # stimes :: Integral b => b -> Term s (PValue 'Sorted 'NoGuarantees) -> Term s (PValue 'Sorted 'NoGuarantees) Source # | |
Semigroup (Term s (PValue 'Sorted 'NonZero)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (<>) :: Term s (PValue 'Sorted 'NonZero) -> Term s (PValue 'Sorted 'NonZero) -> Term s (PValue 'Sorted 'NonZero) Source # sconcat :: NonEmpty (Term s (PValue 'Sorted 'NonZero)) -> Term s (PValue 'Sorted 'NonZero) Source # stimes :: Integral b => b -> Term s (PValue 'Sorted 'NonZero) -> Term s (PValue 'Sorted 'NonZero) Source # | |
Semigroup (Term s (PValue 'Sorted 'Positive)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (<>) :: Term s (PValue 'Sorted 'Positive) -> Term s (PValue 'Sorted 'Positive) -> Term s (PValue 'Sorted 'Positive) Source # sconcat :: NonEmpty (Term s (PValue 'Sorted 'Positive)) -> Term s (PValue 'Sorted 'Positive) Source # stimes :: Integral b => b -> Term s (PValue 'Sorted 'Positive) -> Term s (PValue 'Sorted 'Positive) Source # | |
PIsData (PValue keys amounts) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value pfromDataImpl :: forall (s :: S). Term s (PAsData (PValue keys amounts)) -> Term s (PValue keys amounts) pdataImpl :: forall (s :: S). Term s (PValue keys amounts) -> Term s PData | |
PEq (PValue 'Sorted 'NoGuarantees) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (#==) :: forall (s :: S). Term s (PValue 'Sorted 'NoGuarantees) -> Term s (PValue 'Sorted 'NoGuarantees) -> Term s PBool | |
PEq (PValue 'Sorted 'NonZero) Source # | Since: 2.0.0 |
PEq (PValue 'Sorted 'Positive) Source # | Since: 2.0.0 |
PLiftable (PValue 'Unsorted 'NoGuarantees) Source # | |
Defined in Plutarch.LedgerApi.Value type AsHaskell (PValue 'Unsorted 'NoGuarantees) type PlutusRepr (PValue 'Unsorted 'NoGuarantees) toPlutarchRepr :: AsHaskell (PValue 'Unsorted 'NoGuarantees) -> PlutusRepr (PValue 'Unsorted 'NoGuarantees) toPlutarch :: forall (s :: S). AsHaskell (PValue 'Unsorted 'NoGuarantees) -> PLifted s (PValue 'Unsorted 'NoGuarantees) fromPlutarchRepr :: PlutusRepr (PValue 'Unsorted 'NoGuarantees) -> Maybe (AsHaskell (PValue 'Unsorted 'NoGuarantees)) fromPlutarch :: (forall (s :: S). PLifted s (PValue 'Unsorted 'NoGuarantees)) -> Either LiftError (AsHaskell (PValue 'Unsorted 'NoGuarantees)) | |
PPartialOrd (PValue 'Sorted 'NonZero) Source # | Partial ordering implementation for sorted Use Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (#<=) :: forall (s :: S). Term s (PValue 'Sorted 'NonZero) -> Term s (PValue 'Sorted 'NonZero) -> Term s PBool (#<) :: forall (s :: S). Term s (PValue 'Sorted 'NonZero) -> Term s (PValue 'Sorted 'NonZero) -> Term s PBool (#>=) :: forall (s :: S). Term s (PValue 'Sorted 'NonZero) -> Term s (PValue 'Sorted 'NonZero) -> Term s PBool (#>) :: forall (s :: S). Term s (PValue 'Sorted 'NonZero) -> Term s (PValue 'Sorted 'NonZero) -> Term s PBool | |
PPartialOrd (PValue 'Sorted 'Positive) Source # | Partial ordering implementation for sorted Use Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (#<=) :: forall (s :: S). Term s (PValue 'Sorted 'Positive) -> Term s (PValue 'Sorted 'Positive) -> Term s PBool (#<) :: forall (s :: S). Term s (PValue 'Sorted 'Positive) -> Term s (PValue 'Sorted 'Positive) -> Term s PBool (#>=) :: forall (s :: S). Term s (PValue 'Sorted 'Positive) -> Term s (PValue 'Sorted 'Positive) -> Term s PBool (#>) :: forall (s :: S). Term s (PValue 'Sorted 'Positive) -> Term s (PValue 'Sorted 'Positive) -> Term s PBool | |
DerivePlutusType (PValue keys amounts) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type DPTStrat (PValue keys amounts) | |
PlutusType (PValue keys amounts) Source # | |
Defined in Plutarch.LedgerApi.Value | |
PShow (PValue keys amounts) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
Semigroup (Term s (PValue 'Sorted 'NoGuarantees)) => Group (Term s (PValue 'Sorted 'NoGuarantees)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value inv :: Term s (PValue 'Sorted 'NoGuarantees) -> Term s (PValue 'Sorted 'NoGuarantees) | |
Semigroup (Term s (PValue 'Sorted 'NonZero)) => Group (Term s (PValue 'Sorted 'NonZero)) Source # | Since: 2.0.0 |
Semigroup (Term s (PValue 'Sorted normalization)) => Monoid (Term s (PValue 'Sorted normalization)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
Semigroup (Term s (PValue 'Sorted 'NoGuarantees)) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (<>) :: Term s (PValue 'Sorted 'NoGuarantees) -> Term s (PValue 'Sorted 'NoGuarantees) -> Term s (PValue 'Sorted 'NoGuarantees) | |
Semigroup (Term s (PValue 'Sorted 'NonZero)) Source # | Since: 2.0.0 |
Semigroup (Term s (PValue 'Sorted 'Positive)) Source # | Since: 2.0.0 |
Generic (PValue keys amounts s) Source # | |
type PTryFromExcess PData (PAsData (PValue 'Sorted 'NoGuarantees)) Source # | |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData (PValue 'Sorted 'NoGuarantees)) = PTryFromExcess PData (PInner (PAsData (PValue 'Sorted 'NoGuarantees))) | |
type PTryFromExcess PData (PAsData (PValue 'Sorted 'NonZero)) Source # | |
type PTryFromExcess PData (PAsData (PValue 'Sorted 'Positive)) Source # | |
type PTryFromExcess PData (PAsData (PValue 'Unsorted 'NoGuarantees)) Source # | |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData (PValue 'Unsorted 'NoGuarantees)) = PTryFromExcess PData (PInner (PAsData (PValue 'Unsorted 'NoGuarantees))) | |
type PTryFromExcess PData (PAsData (PValue 'Unsorted 'NonZero)) Source # | |
type PTryFromExcess PData (PAsData (PValue 'Unsorted 'Positive)) Source # | |
type AsHaskell (PValue 'Unsorted 'NoGuarantees) Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value type AsHaskell (PValue 'Unsorted 'NoGuarantees) = AsHaskell (DeriveNewtypePLiftable (PValue 'Unsorted 'NoGuarantees) (PMap 'Unsorted PCurrencySymbol (PMap 'Unsorted PTokenName PInteger)) Value) | |
type PlutusRepr (PValue 'Unsorted 'NoGuarantees) Source # | |
Defined in Plutarch.LedgerApi.Value type PlutusRepr (PValue 'Unsorted 'NoGuarantees) = PlutusRepr (DeriveNewtypePLiftable (PValue 'Unsorted 'NoGuarantees) (PMap 'Unsorted PCurrencySymbol (PMap 'Unsorted PTokenName PInteger)) Value) | |
type DPTStrat (PValue keys amounts) Source # | |
Defined in Plutarch.LedgerApi.Value type DPTStrat (PValue keys amounts) = PlutusTypeNewtype | |
type PContravariant' (PValue keys amounts) Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PCovariant' (PValue keys amounts) Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PInner (PValue keys amounts) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
type PVariant' (PValue keys amounts) Source # | |
Defined in Plutarch.LedgerApi.Value | |
type Rep (PValue keys amounts s) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type Rep (PValue keys amounts s) = D1 ('MetaData "PValue" "Plutarch.LedgerApi.Value" "plutarch-ledger-api-3.2.1-6pZLN6XlvMZ4r7ZEuopoAx" 'True) (C1 ('MetaCons "PValue" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PMap keys PCurrencySymbol (PMap keys PTokenName PInteger)))))) |
newtype PCurrencySymbol (s :: S) Source #
Since: 2.0.0
PCurrencySymbol (Term s (PDataNewtype PByteString)) |
Instances
PIsData PCurrencySymbol Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value pfromDataImpl :: forall (s :: S). Term s (PAsData PCurrencySymbol) -> Term s PCurrencySymbol pdataImpl :: forall (s :: S). Term s PCurrencySymbol -> Term s PData | |
PEq PCurrencySymbol Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (#==) :: forall (s :: S). Term s PCurrencySymbol -> Term s PCurrencySymbol -> Term s PBool | |
PLiftable PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value type AsHaskell PCurrencySymbol type PlutusRepr PCurrencySymbol toPlutarchRepr :: AsHaskell PCurrencySymbol -> PlutusRepr PCurrencySymbol toPlutarch :: forall (s :: S). AsHaskell PCurrencySymbol -> PLifted s PCurrencySymbol fromPlutarchRepr :: PlutusRepr PCurrencySymbol -> Maybe (AsHaskell PCurrencySymbol) fromPlutarch :: (forall (s :: S). PLifted s PCurrencySymbol) -> Either LiftError (AsHaskell PCurrencySymbol) | |
POrd PCurrencySymbol Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value pmax :: forall (s :: S). Term s PCurrencySymbol -> Term s PCurrencySymbol -> Term s PCurrencySymbol pmin :: forall (s :: S). Term s PCurrencySymbol -> Term s PCurrencySymbol -> Term s PCurrencySymbol | |
PPartialOrd PCurrencySymbol Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (#<=) :: forall (s :: S). Term s PCurrencySymbol -> Term s PCurrencySymbol -> Term s PBool (#<) :: forall (s :: S). Term s PCurrencySymbol -> Term s PCurrencySymbol -> Term s PBool (#>=) :: forall (s :: S). Term s PCurrencySymbol -> Term s PCurrencySymbol -> Term s PBool (#>) :: forall (s :: S). Term s PCurrencySymbol -> Term s PCurrencySymbol -> Term s PBool | |
DerivePlutusType PCurrencySymbol Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type DPTStrat PCurrencySymbol | |
PlutusType PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value type PInner PCurrencySymbol :: PType type PCovariant' PCurrencySymbol type PContravariant' PCurrencySymbol type PVariant' PCurrencySymbol pcon' :: forall (s :: S). PCurrencySymbol s -> Term s (PInner PCurrencySymbol) pmatch' :: forall (s :: S) (b :: PType). Term s (PInner PCurrencySymbol) -> (PCurrencySymbol s -> Term s b) -> Term s b | |
PShow PCurrencySymbol Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value pshow' :: forall (s :: S). Bool -> Term s PCurrencySymbol -> Term s PString | |
PTryFrom PData PCurrencySymbol Source # | Since: 3.1.0 |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData PCurrencySymbol :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s PCurrencySymbol, Reduce (PTryFromExcess PData PCurrencySymbol s)) -> Term s r) -> Term s r | |
PTryFrom PData (PAsData PCurrencySymbol) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData PCurrencySymbol) :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s (PAsData PCurrencySymbol), Reduce (PTryFromExcess PData (PAsData PCurrencySymbol) s)) -> Term s r) -> Term s r | |
Generic (PCurrencySymbol s) Source # | |
Defined in Plutarch.LedgerApi.Value from :: PCurrencySymbol s -> Rep (PCurrencySymbol s) x Source # to :: Rep (PCurrencySymbol s) x -> PCurrencySymbol s Source # | |
type AsHaskell PCurrencySymbol Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value | |
type PlutusRepr PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value | |
type DPTStrat PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value type DPTStrat PCurrencySymbol = PlutusTypeNewtype | |
type PContravariant' PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PCovariant' PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PInner PCurrencySymbol Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
type PVariant' PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData PCurrencySymbol Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData (PAsData PCurrencySymbol) Source # | |
Defined in Plutarch.LedgerApi.Value | |
type Rep (PCurrencySymbol s) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type Rep (PCurrencySymbol s) = D1 ('MetaData "PCurrencySymbol" "Plutarch.LedgerApi.Value" "plutarch-ledger-api-3.2.1-6pZLN6XlvMZ4r7ZEuopoAx" 'True) (C1 ('MetaCons "PCurrencySymbol" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PDataNewtype PByteString))))) |
newtype PTokenName (s :: S) Source #
Since: 2.0.0
PTokenName (Term s (PDataNewtype PByteString)) |
Instances
PIsData PTokenName Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value pfromDataImpl :: forall (s :: S). Term s (PAsData PTokenName) -> Term s PTokenName pdataImpl :: forall (s :: S). Term s PTokenName -> Term s PData | |
PEq PTokenName Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value (#==) :: forall (s :: S). Term s PTokenName -> Term s PTokenName -> Term s PBool | |
PLiftable PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value type AsHaskell PTokenName type PlutusRepr PTokenName toPlutarchRepr :: AsHaskell PTokenName -> PlutusRepr PTokenName toPlutarch :: forall (s :: S). AsHaskell PTokenName -> PLifted s PTokenName fromPlutarchRepr :: PlutusRepr PTokenName -> Maybe (AsHaskell PTokenName) fromPlutarch :: (forall (s :: S). PLifted s PTokenName) -> Either LiftError (AsHaskell PTokenName) | |
POrd PTokenName Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value pmax :: forall (s :: S). Term s PTokenName -> Term s PTokenName -> Term s PTokenName pmin :: forall (s :: S). Term s PTokenName -> Term s PTokenName -> Term s PTokenName | |
PPartialOrd PTokenName Source # | @wsince 2.0.0 |
Defined in Plutarch.LedgerApi.Value (#<=) :: forall (s :: S). Term s PTokenName -> Term s PTokenName -> Term s PBool (#<) :: forall (s :: S). Term s PTokenName -> Term s PTokenName -> Term s PBool (#>=) :: forall (s :: S). Term s PTokenName -> Term s PTokenName -> Term s PBool (#>) :: forall (s :: S). Term s PTokenName -> Term s PTokenName -> Term s PBool | |
DerivePlutusType PTokenName Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type DPTStrat PTokenName | |
PlutusType PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value type PInner PTokenName :: PType type PCovariant' PTokenName type PContravariant' PTokenName type PVariant' PTokenName pcon' :: forall (s :: S). PTokenName s -> Term s (PInner PTokenName) pmatch' :: forall (s :: S) (b :: PType). Term s (PInner PTokenName) -> (PTokenName s -> Term s b) -> Term s b | |
PShow PTokenName Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value pshow' :: forall (s :: S). Bool -> Term s PTokenName -> Term s PString | |
PTryFrom PData PTokenName Source # | Since: 3.1.0 |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData PTokenName :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s PTokenName, Reduce (PTryFromExcess PData PTokenName s)) -> Term s r) -> Term s r | |
PTryFrom PData (PAsData PTokenName) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData PTokenName) :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s (PAsData PTokenName), Reduce (PTryFromExcess PData (PAsData PTokenName) s)) -> Term s r) -> Term s r | |
Generic (PTokenName s) Source # | |
Defined in Plutarch.LedgerApi.Value from :: PTokenName s -> Rep (PTokenName s) x Source # to :: Rep (PTokenName s) x -> PTokenName s Source # | |
type AsHaskell PTokenName Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value | |
type PlutusRepr PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value | |
type DPTStrat PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value type DPTStrat PTokenName = PlutusTypeNewtype | |
type PContravariant' PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PCovariant' PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PInner PTokenName Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value | |
type PVariant' PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData PTokenName Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData (PAsData PTokenName) Source # | |
Defined in Plutarch.LedgerApi.Value | |
type Rep (PTokenName s) Source # | Since: 2.0.0 |
Defined in Plutarch.LedgerApi.Value type Rep (PTokenName s) = D1 ('MetaData "PTokenName" "Plutarch.LedgerApi.Value" "plutarch-ledger-api-3.2.1-6pZLN6XlvMZ4r7ZEuopoAx" 'True) (C1 ('MetaCons "PTokenName" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PDataNewtype PByteString))))) |
newtype PLovelace (s :: S) Source #
Since: 2.2.0
PLovelace (Term s (PDataNewtype PInteger)) |
Instances
PIsData PLovelace Source # | Since: 2.2.0 |
Defined in Plutarch.LedgerApi.Value pfromDataImpl :: forall (s :: S). Term s (PAsData PLovelace) -> Term s PLovelace pdataImpl :: forall (s :: S). Term s PLovelace -> Term s PData | |
PEq PLovelace Source # | Since: 2.2.0 |
Defined in Plutarch.LedgerApi.Value | |
PLiftable PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value toPlutarchRepr :: AsHaskell PLovelace -> PlutusRepr PLovelace toPlutarch :: forall (s :: S). AsHaskell PLovelace -> PLifted s PLovelace fromPlutarchRepr :: PlutusRepr PLovelace -> Maybe (AsHaskell PLovelace) fromPlutarch :: (forall (s :: S). PLifted s PLovelace) -> Either LiftError (AsHaskell PLovelace) | |
PPartialOrd PLovelace Source # | Since: 2.2.0 |
Defined in Plutarch.LedgerApi.Value (#<=) :: forall (s :: S). Term s PLovelace -> Term s PLovelace -> Term s PBool (#<) :: forall (s :: S). Term s PLovelace -> Term s PLovelace -> Term s PBool (#>=) :: forall (s :: S). Term s PLovelace -> Term s PLovelace -> Term s PBool (#>) :: forall (s :: S). Term s PLovelace -> Term s PLovelace -> Term s PBool | |
DerivePlutusType PLovelace Source # | Since: 2.2.0 |
Defined in Plutarch.LedgerApi.Value type DPTStrat PLovelace | |
PlutusType PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value | |
PShow PLovelace Source # | Since: 2.2.0 |
Defined in Plutarch.LedgerApi.Value | |
PTryFrom PData PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData PLovelace :: PType | |
PTryFrom PData (PAsData PLovelace) Source # | Since: 3.1.0 |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData PLovelace) :: PType | |
Generic (PLovelace s) Source # | |
type AsHaskell PLovelace Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value | |
type PlutusRepr PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value | |
type DPTStrat PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value type DPTStrat PLovelace = PlutusTypeNewtype | |
type PContravariant' PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PCovariant' PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PInner PLovelace Source # | Since: 2.2.0 |
Defined in Plutarch.LedgerApi.Value | |
type PVariant' PLovelace Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData PLovelace Source # | Since: 3.1.0 |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData (PAsData PLovelace) Source # | |
Defined in Plutarch.LedgerApi.Value | |
type Rep (PLovelace s) Source # | Since: 2.2.0 |
Defined in Plutarch.LedgerApi.Value type Rep (PLovelace s) = D1 ('MetaData "PLovelace" "Plutarch.LedgerApi.Value" "plutarch-ledger-api-3.2.1-6pZLN6XlvMZ4r7ZEuopoAx" 'True) (C1 ('MetaCons "PLovelace" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PDataNewtype PInteger))))) |
newtype PAssetClass (s :: S) Source #
@since WIP
PAssetClass (Term s (PDataNewtype (PBuiltinPair (PAsData PCurrencySymbol) (PAsData PTokenName)))) |
Instances
PIsData PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value pfromDataImpl :: forall (s :: S). Term s (PAsData PAssetClass) -> Term s PAssetClass pdataImpl :: forall (s :: S). Term s PAssetClass -> Term s PData | |
PEq PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value (#==) :: forall (s :: S). Term s PAssetClass -> Term s PAssetClass -> Term s PBool | |
PLiftable PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value type AsHaskell PAssetClass type PlutusRepr PAssetClass toPlutarchRepr :: AsHaskell PAssetClass -> PlutusRepr PAssetClass toPlutarch :: forall (s :: S). AsHaskell PAssetClass -> PLifted s PAssetClass fromPlutarchRepr :: PlutusRepr PAssetClass -> Maybe (AsHaskell PAssetClass) fromPlutarch :: (forall (s :: S). PLifted s PAssetClass) -> Either LiftError (AsHaskell PAssetClass) | |
POrd PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value pmax :: forall (s :: S). Term s PAssetClass -> Term s PAssetClass -> Term s PAssetClass pmin :: forall (s :: S). Term s PAssetClass -> Term s PAssetClass -> Term s PAssetClass | |
PPartialOrd PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value (#<=) :: forall (s :: S). Term s PAssetClass -> Term s PAssetClass -> Term s PBool (#<) :: forall (s :: S). Term s PAssetClass -> Term s PAssetClass -> Term s PBool (#>=) :: forall (s :: S). Term s PAssetClass -> Term s PAssetClass -> Term s PBool (#>) :: forall (s :: S). Term s PAssetClass -> Term s PAssetClass -> Term s PBool | |
DerivePlutusType PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value type DPTStrat PAssetClass | |
PlutusType PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value type PInner PAssetClass :: PType type PCovariant' PAssetClass type PContravariant' PAssetClass type PVariant' PAssetClass pcon' :: forall (s :: S). PAssetClass s -> Term s (PInner PAssetClass) pmatch' :: forall (s :: S) (b :: PType). Term s (PInner PAssetClass) -> (PAssetClass s -> Term s b) -> Term s b | |
PShow PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value pshow' :: forall (s :: S). Bool -> Term s PAssetClass -> Term s PString | |
PTryFrom PData PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData PAssetClass :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s PAssetClass, Reduce (PTryFromExcess PData PAssetClass s)) -> Term s r) -> Term s r | |
PTryFrom PData (PAsData PAssetClass) Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData PAssetClass) :: PType ptryFrom' :: forall (s :: S) (r :: PType). Term s PData -> ((Term s (PAsData PAssetClass), Reduce (PTryFromExcess PData (PAsData PAssetClass) s)) -> Term s r) -> Term s r | |
Generic (PAssetClass s) Source # | |
Defined in Plutarch.LedgerApi.Value from :: PAssetClass s -> Rep (PAssetClass s) x Source # to :: Rep (PAssetClass s) x -> PAssetClass s Source # | |
type AsHaskell PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value | |
type PlutusRepr PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value | |
type DPTStrat PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value type DPTStrat PAssetClass = PlutusTypeNewtype | |
type PContravariant' PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PCovariant' PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PInner PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value | |
type PVariant' PAssetClass Source # | |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData PAssetClass Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value | |
type PTryFromExcess PData (PAsData PAssetClass) Source # | |
Defined in Plutarch.LedgerApi.Value type PTryFromExcess PData (PAsData PAssetClass) = PTryFromExcess PData (PInner (PAsData PAssetClass)) | |
type Rep (PAssetClass s) Source # | @since WIP |
Defined in Plutarch.LedgerApi.Value type Rep (PAssetClass s) = D1 ('MetaData "PAssetClass" "Plutarch.LedgerApi.Value" "plutarch-ledger-api-3.2.1-6pZLN6XlvMZ4r7ZEuopoAx" 'True) (C1 ('MetaCons "PAssetClass" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PDataNewtype (PBuiltinPair (PAsData PCurrencySymbol) (PAsData PTokenName))))))) |
Functions
Creation
PCurrencySymbol
padaSymbol :: forall (s :: S). Term s PCurrencySymbol Source #
The PCurrencySymbol
of the Ada currency.
Since: 2.1.1
padaSymbolData :: forall (s :: S). Term s (PAsData PCurrencySymbol) Source #
Data-encoded PCurrencySymbol
of the Ada currency.
Since: 2.1.1
PTokenName
padaToken :: Term s PTokenName Source #
The PTokenName
of the Ada currency.
Since: 2.1.1
PValue
psingleton :: forall (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> (PInteger :--> PValue 'Sorted 'NonZero))) Source #
Construct a singleton PValue
containing only the given quantity of the
given currency.
Since: 2.1.1
psingletonData :: forall (s :: S). Term s (PAsData PCurrencySymbol :--> (PAsData PTokenName :--> (PAsData PInteger :--> PValue 'Sorted 'NonZero))) Source #
Construct a singleton PValue
containing only the given quantity of the
given currency, taking data-encoded parameters.
Since: 2.1.1
pconstantPositiveSingleton :: forall (s :: S). (forall (s' :: S). Term s' PCurrencySymbol) -> (forall (s' :: S). Term s' PTokenName) -> (forall (s' :: S). Term s' PInteger) -> Term s (PValue 'Sorted 'Positive) Source #
Construct a constant singleton PValue
containing only the given
positive quantity of the given currency.
Since: 2.1.1
Transformation
passertPositive :: forall (kg :: KeyGuarantees) (ag :: AmountGuarantees) (s :: S). Term s (PValue kg ag :--> PValue kg 'Positive) Source #
passertSorted :: forall (anyKey :: KeyGuarantees) (anyAmount :: AmountGuarantees) (s :: S). Term s (PValue anyKey anyAmount :--> PValue 'Sorted 'NonZero) Source #
Assert the value is properly sorted and normalized.
Since: 2.1.1
pforgetPositive :: forall (a :: AmountGuarantees) (k :: KeyGuarantees) (s :: S). Term s (PValue k 'Positive) -> Term s (PValue k a) Source #
'Forget' that a Value
has an only-positive guarantee.
Since: 2.0.0
pforgetSorted :: forall (a :: AmountGuarantees) (k :: KeyGuarantees) (s :: S). Term s (PValue 'Sorted a) -> Term s (PValue k a) Source #
Forget the knowledge of all value's guarantees.
Since: 2.1.1
pnormalize :: forall (any :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted any :--> PValue 'Sorted 'NonZero) Source #
Normalize the argument to contain no zero quantity nor empty token map.
Since: 2.0.0
padaOnlyValue :: forall (v :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted v :--> PValue 'Sorted v) Source #
Strip all non-Ada from a PValue
.
Since: 2.1.1
pnoAdaValue :: forall (v :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted v :--> PValue 'Sorted v) Source #
Strip all Ada from a PValue
.
Since: 2.1.1
Partial ordering
pcheckBinRel :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Term s ((PInteger :--> (PInteger :--> PBool)) :--> (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PBool))) Source #
Given a description of a relation on amounts, check whether that relation
holds over sorted PValue
s.
Important note
This is intended for use with boolean comparison functions, which must define at least a partial order (total orders and equivalences are acceptable as well). Use of this with anything else is not guaranteed to give anything resembling a sensible answer. Use with extreme care.
Since: 2.0.0
Combination
pleftBiasedCurrencyUnion :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees)) Source #
Combine two PValue
s, taking the tokens from the left only, if a
currency occurs on both sides.
Since: 2.1.1
pleftBiasedTokenUnion :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees)) Source #
Combine two PValue
s, taking the tokens from the left only, if a token name
of the same currency occurs on both sides.
Prefer this over 'punionResolvingCollisionsWith NonCommutative # plam const'. It is equivalent, but performs better.
Since: 2.1.1
punionResolvingCollisionsWith :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Commutativity -> Term s ((PInteger :--> (PInteger :--> PInteger)) :--> (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees))) Source #
Combine two PValue
s applying the given function to any pair of
quantities with the same asset class. Note that the result is _not_
normalize
d and may contain zero quantities.
Since: 2.0.0
punionResolvingCollisionsWithData :: forall (any0 :: AmountGuarantees) (any1 :: AmountGuarantees) (s :: S). Commutativity -> Term s ((PAsData PInteger :--> (PAsData PInteger :--> PAsData PInteger)) :--> (PValue 'Sorted any0 :--> (PValue 'Sorted any1 :--> PValue 'Sorted 'NoGuarantees))) Source #
Combine two PValue
s applying the given function to any pair of
data-encoded quantities with the same asset class. Note that the result is
_not_ normalize
d and may contain zero quantities.
Since: 2.1.1
Queries
pvalueOf :: forall (anyKey :: KeyGuarantees) (anyAmount :: AmountGuarantees) (s :: S). Term s (PValue anyKey anyAmount :--> (PCurrencySymbol :--> (PTokenName :--> PInteger))) Source #
Get the quantity of the given currency in the PValue
.
Since: 2.1.1
plovelaceValueOf :: forall (v :: AmountGuarantees) (s :: S). Term s (PValue 'Sorted v :--> PInteger) Source #
Get the amount of Lovelace in the PValue
.
Since: 2.1.1