Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype PDataSum defs s = PDataSum (NS (Compose (Term s) PDataRecord) defs)
- punDataSum :: Term s (PDataSum '[def] :--> PDataRecord def)
- ptryIndexDataSum :: KnownNat n => Proxy n -> Term s (PDataSum (def ': defs) :--> PDataRecord (IndexList n (def ': defs)))
- pdcons :: forall label a l s. Term s (PAsData a :--> (PDataRecord l :--> PDataRecord ((label ':= a) ': l)))
- pdnil :: Term s (PDataRecord '[])
- data DataReprHandlers (out :: S -> Type) (defs :: [[PLabeledType]]) (s :: S) where
- DRHNil :: DataReprHandlers out '[] s
- DRHCons :: (Term s (PDataRecord def) -> Term s out) -> DataReprHandlers out defs s -> DataReprHandlers out (def ': defs) s
- data PDataRecord (as :: [PLabeledType]) (s :: S) where
- PDCons :: forall name_x x xs s. PUnLabel name_x ~ x => Term s (PAsData x) -> Term s (PDataRecord xs) -> PDataRecord (name_x ': xs) s
- PDNil :: PDataRecord '[] s
- data PLabeledType = Symbol := (S -> Type)
- type family PLabelIndex (name :: Symbol) (as :: [PLabeledType]) :: Nat where ...
- type family PUnLabel (a :: PLabeledType) :: S -> Type where ...
- type family PLookupLabel name as where ...
- pindexDataRecord :: KnownNat n => Proxy n -> Term s (PDataRecord as) -> Term s (PAsData (PUnLabel (IndexList n as)))
- pdropDataRecord :: KnownNat n => Proxy n -> Term s (PDataRecord xs) -> Term s (PDataRecord (Drop n xs))
- newtype DualReprHandler s out def = DualRepr (Term s (PDataRecord def) -> Term s (PDataRecord def) -> Term s out)
- data PlutusTypeData
Documentation
newtype PDataSum defs s Source #
A sum of PDataRecord
s. The underlying representation is the Constr
constructor,
where the integer is the index of the variant and the list is the record.
PDataSum (NS (Compose (Term s) PDataRecord) defs) |
Instances
punDataSum :: Term s (PDataSum '[def] :--> PDataRecord def) Source #
If there is only a single variant, then we can safely extract it.
ptryIndexDataSum :: KnownNat n => Proxy n -> Term s (PDataSum (def ': defs) :--> PDataRecord (IndexList n (def ': defs))) Source #
Try getting the nth variant. Errs if it's another variant.
pdcons :: forall label a l 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 :: Term s (PDataRecord '[]) Source #
An empty PDataRecord
.
data DataReprHandlers (out :: S -> Type) (defs :: [[PLabeledType]]) (s :: S) where Source #
DRHNil :: DataReprHandlers out '[] s | |
DRHCons :: (Term s (PDataRecord def) -> Term s out) -> DataReprHandlers out defs s -> DataReprHandlers out (def ': defs) s |
data PDataRecord (as :: [PLabeledType]) (s :: S) where Source #
A "record" of `exists a. PAsData a`. The underlying representation is `PBuiltinList PData`.
PDCons :: forall name_x x xs s. PUnLabel name_x ~ x => Term s (PAsData x) -> Term s (PDataRecord xs) -> PDataRecord (name_x ': xs) s | |
PDNil :: PDataRecord '[] s |
Instances
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 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 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 pmax :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) Source # pmin :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) Source # | |
(SListI xs, POrd x, PIsData x, POrd (PDataRecord (x' ': xs))) => PPartialOrd (PDataRecord ((label ':= x) ': (x' ': xs))) Source # | |
Defined in Plutarch.DataRepr.Internal (#<=) :: 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 # (#>=) :: 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 # | |
(POrd x, PIsData x) => PPartialOrd (PDataRecord '[label ':= x]) Source # | |
Defined in Plutarch.DataRepr.Internal (#<=) :: 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 # (#>=) :: 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 # | |
PPartialOrd (PDataRecord ('[] :: [PLabeledType])) Source # | |
Defined in Plutarch.DataRepr.Internal (#<=) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool Source # (#<) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool Source # (#>=) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool Source # (#>) :: forall (s :: S). Term s (PDataRecord '[]) -> Term s (PDataRecord '[]) -> Term s PBool 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 | |
(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 type PTryFromExcess (PBuiltinList PData) (PDataRecord ((name ':= pty) ': as)) :: PType Source # ptryFrom' :: forall (s :: S) (r :: PType). 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 type PTryFromExcess (PBuiltinList PData) (PDataRecord '[]) :: PType Source # ptryFrom' :: forall (s :: S) (r :: PType). Term s (PBuiltinList PData) -> ((Term s (PDataRecord '[]), Reduce (PTryFromExcess (PBuiltinList PData) (PDataRecord '[]) 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 |
type family PLabelIndex (name :: Symbol) (as :: [PLabeledType]) :: Nat where ... Source #
PLabelIndex name ((name ':= _) ': _) = 0 | |
PLabelIndex name (_ ': as) = PLabelIndex name as + 1 |
type family PLookupLabel name as where ... Source #
PLookupLabel name ((name ':= a) ': _) = a | |
PLookupLabel name (_ ': as) = PLookupLabel name as |
pindexDataRecord :: KnownNat n => Proxy n -> Term s (PDataRecord as) -> Term s (PAsData (PUnLabel (IndexList n as))) Source #
Safely index a PDataRecord
.
pdropDataRecord :: KnownNat n => Proxy n -> Term s (PDataRecord xs) -> Term s (PDataRecord (Drop n xs)) Source #
Safely drop the first n items of a PDataRecord
.
newtype DualReprHandler s out def Source #
DualRepr (Term s (PDataRecord def) -> Term s (PDataRecord def) -> Term s out) |
data PlutusTypeData Source #
Instances
PlutusTypeStrat PlutusTypeData Source # | |
Defined in Plutarch.DataRepr.Internal type PlutusTypeStratConstraint PlutusTypeData :: PType -> Constraint Source # type DerivedPInner PlutusTypeData a :: PType Source # derivedPCon :: forall a (s :: S). (DerivePlutusType a, DPTStrat a ~ PlutusTypeData) => a s -> Term s (DerivedPInner PlutusTypeData a) Source # derivedPMatch :: forall a (s :: S) (b :: PType). (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 |