Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Provides Data and Scott encoded asset class types and utility functions.
Synopsis
- data AssetClass = AssetClass {}
- assetClassValue :: forall {k :: Type} (unit :: k). Tagged unit AssetClass -> Tagged unit Integer -> Value
- data PAssetClass (s :: S) = PAssetClass {
- psymbol :: Term s (PAsData PCurrencySymbol)
- pname :: Term s (PAsData PTokenName)
- passetClass :: forall (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PAssetClass))
- passetClassT :: forall {k :: Type} (unit :: k) (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PTagged unit PAssetClass))
- adaSymbolData :: forall (s :: S). Term s (PAsData PCurrencySymbol)
- isAdaClass :: forall (a :: Type) (k :: Type). (Is k A_Getter, LabelOptic' "symbol" k a CurrencySymbol, LabelOptic' "name" k a TokenName) => a -> Bool
- adaClass :: Tagged "Ada" AssetClass
- padaClass :: forall (s :: S). Term s (PTagged "Ada" PAssetClass)
- emptyTokenNameData :: forall (s :: S). Term s (PAsData PTokenName)
- psymbolAssetClass :: forall (s :: S). Term s (PCurrencySymbol :--> PAssetClass)
- psymbolAssetClassT :: forall {k :: Type} (unit :: k) (s :: S). Term s (PCurrencySymbol :--> PTagged unit PAssetClass)
- pconstantClass :: forall (a :: Type) (k :: Type) (s :: S). (Is k A_Getter, LabelOptic' "symbol" k a CurrencySymbol, LabelOptic' "name" k a TokenName) => a -> Term s PAssetClass
- pconstantClassT :: forall {k :: Type} (unit :: k) (s :: S). Tagged unit AssetClass -> Term s (PTagged unit PAssetClass)
- newtype PAssetClassData (s :: S) = PAssetClassData (Term s (PDataRecord '["symbol" := PCurrencySymbol, "name" := PTokenName]))
- passetClassData :: forall (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PAssetClassData))
- passetClassDataT :: forall {k :: Type} (unit :: k) (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PTagged unit PAssetClassData))
- ptoScottEncoding :: forall (s :: S). Term s (PAssetClassData :--> PAssetClass)
- pfromScottEncoding :: forall (s :: S). Term s (PAssetClass :--> PAssetClassData)
- pviaScottEncoding :: forall (a :: PType). ClosedTerm (PAssetClass :--> a) -> ClosedTerm (PAssetClassData :--> a)
- data AdaClassPresence
- newtype GenAssetClass (p :: AdaClassPresence) = GenAssetClass AssetClass
AssetClass - Hask
data AssetClass Source #
A version of AssetClass
, with a tag for currency.
Since: 3.10.0
AssetClass | |
|
Instances
assetClassValue :: forall {k :: Type} (unit :: k). Tagged unit AssetClass -> Tagged unit Integer -> Value Source #
Version of assetClassValue
for tagged AssetClass
and Tagged
.
Since: 3.10.4
AssetClass - Plutarch
data PAssetClass (s :: S) Source #
A Scott-encoded Plutarch equivalent to AssetClass
.
Since: 3.10.0
PAssetClass | |
|
Instances
passetClass :: forall (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PAssetClass)) Source #
Since: 3.10.0
passetClassT :: forall {k :: Type} (unit :: k) (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PTagged unit PAssetClass)) Source #
Since: 3.10.4
adaSymbolData :: forall (s :: S). Term s (PAsData PCurrencySymbol) Source #
The PCurrencySymbol
for Ada, corresponding to an empty string.
Since: 3.9.0
isAdaClass :: forall (a :: Type) (k :: Type). (Is k A_Getter, LabelOptic' "symbol" k a CurrencySymbol, LabelOptic' "name" k a TokenName) => a -> Bool Source #
Check whether an AssetClass
corresponds to Ada.
Since: 3.9.0
adaClass :: Tagged "Ada" AssetClass Source #
The AssetClass
for Ada, corresponding to an empty currency symbol and
token name.
Since: 3.9.0
padaClass :: forall (s :: S). Term s (PTagged "Ada" PAssetClass) Source #
Plutarch equivalent for adaClass
.
Since: 3.9.0
emptyTokenNameData :: forall (s :: S). Term s (PAsData PTokenName) Source #
The empty PTokenName
Since: 3.9.0
psymbolAssetClass :: forall (s :: S). Term s (PCurrencySymbol :--> PAssetClass) Source #
Construct a PAssetClass
with empty pname
.
@since 3.9.0
psymbolAssetClassT :: forall {k :: Type} (unit :: k) (s :: S). Term s (PCurrencySymbol :--> PTagged unit PAssetClass) Source #
Tagged version of psymbolAssetClass
@since 3.10.4
pconstantClass :: forall (a :: Type) (k :: Type) (s :: S). (Is k A_Getter, LabelOptic' "symbol" k a CurrencySymbol, LabelOptic' "name" k a TokenName) => a -> Term s PAssetClass Source #
Since: 3.10.0
pconstantClassT :: forall {k :: Type} (unit :: k) (s :: S). Tagged unit AssetClass -> Term s (PTagged unit PAssetClass) Source #
Since: 3.10.4
AssetClassData - Plutarch
newtype PAssetClassData (s :: S) Source #
A Data
-encoded version of AssetClass
, without the currency
tag.
Since: 3.10.0
PAssetClassData (Term s (PDataRecord '["symbol" := PCurrencySymbol, "name" := PTokenName])) |
Instances
passetClassData :: forall (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PAssetClassData)) Source #
Since: 3.10.0
passetClassDataT :: forall {k :: Type} (unit :: k) (s :: S). Term s (PCurrencySymbol :--> (PTokenName :--> PTagged unit PAssetClassData)) Source #
Since: 3.10.4
Scott - Data conversions
ptoScottEncoding :: forall (s :: S). Term s (PAssetClassData :--> PAssetClass) Source #
Convert from PAssetClassData
to PAssetClass
.
Since: 3.10.4
pfromScottEncoding :: forall (s :: S). Term s (PAssetClass :--> PAssetClassData) Source #
Convert from PAssetClass
to PAssetClassData
.
Since: 3.10.4
pviaScottEncoding :: forall (a :: PType). ClosedTerm (PAssetClass :--> a) -> ClosedTerm (PAssetClassData :--> a) Source #
Wrap a function using the Scott-encoded PAssetClass
to one using the
Data
-encoded version.
Since: 3.10.4
Modifiers for QuickCheck
data AdaClassPresence Source #
Type-level marker to indicate whether a GenAssetClass
can have the ADA
AssetClass
inside it or not.
Since: 3.11.1
Instances
Show AdaClassPresence Source # | Since: 3.10.5 |
Defined in Plutarch.Extra.AssetClass | |
Eq AdaClassPresence Source # | Since: 3.10.5 |
Defined in Plutarch.Extra.AssetClass (==) :: AdaClassPresence -> AdaClassPresence -> Bool Source # (/=) :: AdaClassPresence -> AdaClassPresence -> Bool Source # | |
Ord AdaClassPresence Source # | Since: 3.10.5 |
Defined in Plutarch.Extra.AssetClass compare :: AdaClassPresence -> AdaClassPresence -> Ordering Source # (<) :: AdaClassPresence -> AdaClassPresence -> Bool Source # (<=) :: AdaClassPresence -> AdaClassPresence -> Bool Source # (>) :: AdaClassPresence -> AdaClassPresence -> Bool Source # (>=) :: AdaClassPresence -> AdaClassPresence -> Bool Source # max :: AdaClassPresence -> AdaClassPresence -> AdaClassPresence Source # min :: AdaClassPresence -> AdaClassPresence -> AdaClassPresence Source # |
newtype GenAssetClass (p :: AdaClassPresence) Source #
A helper newtype for QuickCheck use with AssetClass
es. Has a type-level
tag to indicate whether it could potentially contain the ADA AssetClass
. We
provide instances of Arbitrary
, CoArbitrary
and Function
around this
newtype, intended to act on the AssetClass
inside it.
The easiest way to use this newtype is by pattern matching:
forAll arbitrary $ \((GenAssetClass ac) :: GenAssetClass WithAdaClass) -> ...
You can also 're-wrap' for shrinking:
shrink (GenAssetClass ac :: GenAssetClass WithAdaClass)
Note
Due to limitations in QuickCheck itself, GenCurrencySymbol
with the
WithAdaSymbol
tag over-represents the ADA symbol. We inherit this behaviour
on all instances of GenAssetClass
with th WithAdaClass
tag.
Since: 3.11.1