| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Plutarch.LedgerApi.AssocMap
Description
This module is designed to be imported qualified, as many of its identifiers clash with the Plutarch prelude.
Synopsis
- data PSortedMap (k :: S -> Type) (v :: S -> Type) (s :: S)
- newtype PUnsortedMap (k :: S -> Type) (v :: S -> Type) (s :: S) = PUnsortedMap (Term s (PAssocMap k v))
- newtype PAssocMap (k :: S -> Type) (v :: S -> Type) (s :: S) = PAssocMap (Term s (PBuiltinList (PBuiltinPair (PAsData k) (PAsData v))))
- data MergeHandler (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) = MergeHandler {
- mhBothPresent :: BothPresentHandler s k a b c
- mhLeftPresent :: OnePresentHandler s k a c
- mhRightPresent :: OnePresentHandler s k b c
- data BothPresentHandler (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type)
- = DropBoth
- | HandleBoth (Term s (k :--> (a :--> (b :--> c))))
- | HandleOrDropBoth (Term s (k :--> (a :--> (b :--> PMaybe c))))
- data OnePresentHandler (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type)
- = DropOne
- | HandleOne (Term s (k :--> (a :--> b)))
- | HandleOrDropOne (Term s (k :--> (a :--> PMaybe b)))
- pempty :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). PInner (t k v) ~ PAssocMap k v => Term s (t k v)
- psingleton :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PInner (t k v) ~ PAssocMap k v, PIsData k, PIsData v) => Term s (k :--> (v :--> t k v))
- psingletonData :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). PInner (t k v) ~ PAssocMap k v => Term s (PAsData k :--> (PAsData v :--> t k v))
- punsortedMapFromFoldable :: forall (k :: S -> Type) (v :: S -> Type) f (s :: S). (Foldable f, PIsData k, PIsData v) => f (Term s k, Term s v) -> Term s (PUnsortedMap k v)
- psortedMapFromFoldable :: forall (k :: S -> Type) (v :: S -> Type) f (s :: S). (Foldable f, POrd k, PIsData k, PIsData v) => f (Term s k, Term s v) -> Term s (PSortedMap k v)
- passertSorted :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s (PUnsortedMap k v :--> PSortedMap k v)
- ppromoteToSortedMap :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s (PUnsortedMap k v :--> PSortedMap k v)
- punsafeCoerceToSortedMap :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PUnsortedMap k v) -> Term s (PSortedMap k v)
- pforgetSorted :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PSortedMap k v) -> Term s (PUnsortedMap k v)
- pmap :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData a, PIsData b) => Term s ((a :--> b) :--> (t k a :--> t k b))
- pmapData :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b) => Term s ((PAsData a :--> PAsData b) :--> (t k a :--> t k b))
- pmapWithKey :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData k, PIsData a, PIsData b) => Term s ((k :--> (a :--> b)) :--> (t k a :--> t k b))
- pmapMaybe :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData a, PIsData b) => Term s ((a :--> PMaybe b) :--> (t k a :--> t k b))
- pmapMaybeData :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b) => Term s ((PAsData a :--> PMaybe (PAsData b)) :--> (t k a :--> t k b))
- pmapMaybeWithKey :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData k, PIsData a, PIsData b) => Term s ((k :--> (a :--> PMaybe b)) :--> (t k a :--> t k b))
- pmapMaybeDataWithKey :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b) => Term s ((PAsData k :--> (PAsData a :--> PMaybe (PAsData b))) :--> (t k a :--> t k b))
- pcheckBinRel :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> PBool)) :--> (v :--> (PSortedMap k v :--> (PSortedMap k v :--> PBool))))
- pkeysEqual :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PEq k, PIsData k) => Term s (PSortedMap k a :--> (PSortedMap k b :--> PBool))
- pkeysEqualUnsorted :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PIsData k, PIsData a, PIsData b) => Term s (PUnsortedMap k a :--> (PUnsortedMap k b :--> PBool))
- pall :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData v => Term s ((v :--> PBool) :--> (PUnsortedMap k v :--> PBool))
- pany :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData v => Term s ((v :--> PBool) :--> (PUnsortedMap k v :--> PBool))
- pfoldMapWithKey :: forall (m :: S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v, forall (s' :: S). Monoid (Term s' m)) => Term s ((k :--> (v :--> m)) :--> (PUnsortedMap k v :--> m))
- pfoldlWithKey :: forall (a :: S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s ((a :--> (k :--> (v :--> a))) :--> (a :--> (PUnsortedMap k v :--> a)))
- zipWithBuilder :: forall (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type). (POrd k, PIsData k, PIsData a, PIsData b, PIsData c) => MergeHandler s k a b c -> Term s (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c))
- zipWithDataBuilder :: forall (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type). (POrd k, PIsData k) => MergeHandler s (PAsData k) (PAsData a) (PAsData b) (PAsData c) -> Term s (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c))
- punionWith :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> v)) :--> (PSortedMap k v :--> (PSortedMap k v :--> PSortedMap k v)))
- punionWithData :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s ((PAsData v :--> (PAsData v :--> PAsData v)) :--> (PSortedMap k v :--> (PSortedMap k v :--> PSortedMap k v)))
- pleftBiasedUnion :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s (PSortedMap k v :--> (PSortedMap k v :--> PSortedMap k v))
- pdifference :: forall (b :: S -> Type) (a :: S -> Type) (k :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b) => Term s (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k a))
- pdifferenceWith :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b) => Term s ((a :--> (b :--> PMaybe a)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k a)))
- pzipWithDefaults :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b, PIsData c) => (forall (s' :: S). Term s' a) -> (forall (s' :: S). Term s' b) -> Term s ((a :--> (b :--> c)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c)))
- pintersectionWith :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b, PIsData c) => Term s ((a :--> (b :--> c)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c)))
- pintersectionWithData :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s ((PAsData a :--> (PAsData b :--> PAsData c)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c)))
- pnull :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PUnsortedMap k v :--> PBool)
- plookup :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s (k :--> (PSortedMap k v :--> PMaybe v))
- plookupData :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PAsData k :--> (PSortedMap k v :--> PMaybe (PAsData v)))
- plookupDataWith :: forall (k :: S -> Type) (v :: S -> Type) (x :: S -> Type) (s :: S). Term s ((PBuiltinPair (PAsData k) (PAsData v) :--> PMaybe x) :--> (PAsData k :--> (PSortedMap k v :--> PMaybe x)))
- pfindWithDefault :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s (v :--> (k :--> (PSortedMap k v :--> v)))
- pfoldAt :: forall (k :: S -> Type) (v :: S -> Type) (r :: S -> Type) (s :: S). PIsData k => Term s (k :--> (r :--> ((PAsData v :--> r) :--> (PSortedMap k v :--> r))))
- pfoldAtData :: forall (k :: S -> Type) (v :: S -> Type) (r :: S -> Type) (s :: S). Term s (PAsData k :--> (r :--> ((PAsData v :--> r) :--> (PSortedMap k v :--> r))))
- ptryLookup :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s (k :--> (PSortedMap k v :--> v))
- pinsert :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s (k :--> (v :--> (PSortedMap k v :--> PSortedMap k v)))
- pdelete :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s (k :--> (PSortedMap k v :--> PSortedMap k v))
- pupdate :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v, POrd k) => Term s ((v :--> PMaybe v) :--> (k :--> (PSortedMap k v :--> PSortedMap k v)))
- padjust :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PInner (t k v) ~ PAssocMap k v, PIsData k, PEq k, PIsData v) => Term s ((v :--> v) :--> (k :--> (t k v :--> t k v)))
- pkvPairKey :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData k => Term s (PBuiltinPair (PAsData k) (PAsData v) :--> k)
- pkvPairValue :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData v => Term s (PBuiltinPair (PAsData k) (PAsData v) :--> v)
- pkvPairLt :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, POrd k) => Term s (PBuiltinPair (PAsData k) (PAsData v) :--> (PBuiltinPair (PAsData k) (PAsData v) :--> PBool))
- pkeys :: forall (ell :: (S -> Type) -> S -> Type) (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PInner (t k v) ~ PAssocMap k v, PListLike ell, PElemConstraint ell (PAsData k)) => Term s (t k v :--> ell (PAsData k))
Types
data PSortedMap (k :: S -> Type) (v :: S -> Type) (s :: S) Source #
Instances
| (POrd k, PIsData k, PTryFrom PData (PAsData k), PTryFrom PData (PAsData v)) => PTryFrom PData (PAsData (PSortedMap k v)) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s PData -> ((Term s (PAsData (PSortedMap k v)), Reduce (PTryFromExcess PData (PAsData (PSortedMap k v)) s)) -> Term s r) -> Term s r | |||||
| PEq (PSortedMap k v) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap Methods (#==) :: forall (s :: S). Term s (PSortedMap k v) -> Term s (PSortedMap k v) -> Term s PBool | |||||
| PIsData (PSortedMap k v) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PSortedMap k v)) -> Term s (PSortedMap k v) pdataImpl :: forall (s :: S). Term s (PSortedMap k v) -> Term s PData | |||||
| (PValidateData k, PValidateData v, POrd k, PIsData k) => PValidateData (PSortedMap k v) Source # | Checks that we have a valid Since: 3.6.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap Methods pwithValidated :: forall (s :: S). Term s PData -> forall (r :: S -> Type). Term s r -> Term s r | |||||
| PlutusType (PSortedMap k v) Source # | |||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods pcon' :: forall (s :: S). PSortedMap k v s -> Term s (PInner (PSortedMap k v)) pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PSortedMap k v)) -> (PSortedMap k v s -> Term s b) -> Term s b | |||||
| (PIsData k, PIsData v, PShow k, PShow v) => PShow (PSortedMap k v) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap Methods pshow' :: forall (s :: S). Bool -> Term s (PSortedMap k v) -> Term s PString | |||||
| Generic (PSortedMap k v s) Source # | |||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods from :: PSortedMap k v s -> Rep (PSortedMap k v s) x Source # to :: Rep (PSortedMap k v s) x -> PSortedMap k v s Source # | |||||
| Generic (PSortedMap k v s) Source # | |||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods from :: PSortedMap k v s -> Rep (PSortedMap k v s) to :: Rep (PSortedMap k v s) -> PSortedMap k v s | |||||
| type PTryFromExcess PData (PAsData (PSortedMap k v)) Source # | |||||
Defined in Plutarch.LedgerApi.AssocMap type PTryFromExcess PData (PAsData (PSortedMap k v)) = PTryFromExcess PData (PInner (PAsData (PSortedMap k v))) | |||||
| type PInner (PSortedMap k v) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap | |||||
| type Rep (PSortedMap k v s) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap type Rep (PSortedMap k v s) = D1 ('MetaData "PSortedMap" "Plutarch.LedgerApi.AssocMap" "plutarch-ledger-api-3.6.0-JzNzlZYfKM24p3vIfYHfrb" 'True) (C1 ('MetaCons "PSortedMap" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PAssocMap k v))))) | |||||
| type Code (PSortedMap k v s) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap | |||||
newtype PUnsortedMap (k :: S -> Type) (v :: S -> Type) (s :: S) Source #
Since: 3.5.0
Constructors
| PUnsortedMap (Term s (PAssocMap k v)) |
Instances
| (PTryFrom PData (PAsData k), PTryFrom PData (PAsData v)) => PTryFrom PData (PAsData (PUnsortedMap k v)) Source # | Since: 3.5.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods ptryFrom' :: forall (s :: S) (r :: S -> Type). Term s PData -> ((Term s (PAsData (PUnsortedMap k v)), Reduce (PTryFromExcess PData (PAsData (PUnsortedMap k v)) s)) -> Term s r) -> Term s r | |||||||||
| PIsData (PUnsortedMap k v) Source # | Since: 3.5.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PUnsortedMap k v)) -> Term s (PUnsortedMap k v) pdataImpl :: forall (s :: S). Term s (PUnsortedMap k v) -> Term s PData | |||||||||
| (ToData (AsHaskell k), ToData (AsHaskell v), FromData (AsHaskell k), FromData (AsHaskell v)) => PLiftable (PUnsortedMap k v) Source # | Since: 3.5.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods haskToRepr :: AsHaskell (PUnsortedMap k v) -> PlutusRepr (PUnsortedMap k v) reprToHask :: PlutusRepr (PUnsortedMap k v) -> Either LiftError (AsHaskell (PUnsortedMap k v)) reprToPlut :: forall (s :: S). PlutusRepr (PUnsortedMap k v) -> PLifted s (PUnsortedMap k v) plutToRepr :: (forall (s :: S). PLifted s (PUnsortedMap k v)) -> Either LiftError (PlutusRepr (PUnsortedMap k v)) | |||||||||
| (PValidateData k, PValidateData v) => PValidateData (PUnsortedMap k v) Source # | Since: 3.6.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap Methods pwithValidated :: forall (s :: S). Term s PData -> forall (r :: S -> Type). Term s r -> Term s r | |||||||||
| PlutusType (PUnsortedMap k v) Source # | |||||||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods pcon' :: forall (s :: S). PUnsortedMap k v s -> Term s (PInner (PUnsortedMap k v)) pmatch' :: forall (s :: S) (b :: S -> Type). Term s (PInner (PUnsortedMap k v)) -> (PUnsortedMap k v s -> Term s b) -> Term s b | |||||||||
| (PIsData k, PIsData v, PShow k, PShow v) => PShow (PUnsortedMap k v) Source # | Since: 3.5.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap Methods pshow' :: forall (s :: S). Bool -> Term s (PUnsortedMap k v) -> Term s PString | |||||||||
| Generic (PUnsortedMap k v s) Source # | |||||||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods from :: PUnsortedMap k v s -> Rep (PUnsortedMap k v s) x Source # to :: Rep (PUnsortedMap k v s) x -> PUnsortedMap k v s Source # | |||||||||
| Generic (PUnsortedMap k v s) Source # | |||||||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
Methods from :: PUnsortedMap k v s -> Rep (PUnsortedMap k v s) to :: Rep (PUnsortedMap k v s) -> PUnsortedMap k v s | |||||||||
| type PTryFromExcess PData (PAsData (PUnsortedMap k v)) Source # | |||||||||
Defined in Plutarch.LedgerApi.AssocMap type PTryFromExcess PData (PAsData (PUnsortedMap k v)) = PTryFromExcess PData (PInner (PAsData (PUnsortedMap k v))) | |||||||||
| type AsHaskell (PUnsortedMap k v) Source # | |||||||||
Defined in Plutarch.LedgerApi.AssocMap type AsHaskell (PUnsortedMap k v) = Map (AsHaskell k) (AsHaskell v) | |||||||||
| type PlutusRepr (PUnsortedMap k v) Source # | |||||||||
Defined in Plutarch.LedgerApi.AssocMap type PlutusRepr (PUnsortedMap k v) = [(Data, Data)] | |||||||||
| type PInner (PUnsortedMap k v) Source # | Since: 3.5.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap | |||||||||
| type Rep (PUnsortedMap k v s) Source # | Since: 3.5.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap type Rep (PUnsortedMap k v s) = D1 ('MetaData "PUnsortedMap" "Plutarch.LedgerApi.AssocMap" "plutarch-ledger-api-3.6.0-JzNzlZYfKM24p3vIfYHfrb" 'True) (C1 ('MetaCons "PUnsortedMap" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PAssocMap k v))))) | |||||||||
| type Code (PUnsortedMap k v s) Source # | Since: 3.5.0 | ||||||||
Defined in Plutarch.LedgerApi.AssocMap | |||||||||
newtype PAssocMap (k :: S -> Type) (v :: S -> Type) (s :: S) Source #
Since: 3.5.0
Constructors
| PAssocMap (Term s (PBuiltinList (PBuiltinPair (PAsData k) (PAsData v)))) |
Instances
| PIsData (PAssocMap k v) Source # | Since: 3.6.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap Methods pfromDataImpl :: forall (s :: S). Term s (PAsData (PAssocMap k v)) -> Term s (PAssocMap k v) pdataImpl :: forall (s :: S). Term s (PAssocMap k v) -> Term s PData | |||||
| (PValidateData k, PValidateData v) => PValidateData (PAssocMap k v) Source # | Since: 3.6.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap Methods pwithValidated :: forall (s :: S). Term s PData -> forall (r :: S -> Type). Term s r -> Term s r | |||||
| PlutusType (PAssocMap k v) Source # | |||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
| |||||
| (PIsData k, PIsData v, PShow k, PShow v) => PShow (PAssocMap k v) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap | |||||
| Generic (PAssocMap k v s) Source # | |||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
| |||||
| Generic (PAssocMap k v s) Source # | |||||
Defined in Plutarch.LedgerApi.AssocMap Associated Types
| |||||
| type PInner (PAssocMap k v) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap | |||||
| type Rep (PAssocMap k v s) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap type Rep (PAssocMap k v s) = D1 ('MetaData "PAssocMap" "Plutarch.LedgerApi.AssocMap" "plutarch-ledger-api-3.6.0-JzNzlZYfKM24p3vIfYHfrb" 'True) (C1 ('MetaCons "PAssocMap" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Term s (PBuiltinList (PBuiltinPair (PAsData k) (PAsData v))))))) | |||||
| type Code (PAssocMap k v s) Source # | Since: 3.5.0 | ||||
Defined in Plutarch.LedgerApi.AssocMap | |||||
data MergeHandler (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) Source #
Constructors
| MergeHandler | |
Fields
| |
data BothPresentHandler (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) Source #
Constructors
| DropBoth | |
| HandleBoth (Term s (k :--> (a :--> (b :--> c)))) | |
| HandleOrDropBoth (Term s (k :--> (a :--> (b :--> PMaybe c)))) |
data OnePresentHandler (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) Source #
Constructors
| DropOne | |
| HandleOne (Term s (k :--> (a :--> b))) | |
| HandleOrDropOne (Term s (k :--> (a :--> PMaybe b))) |
Functions
Creation
pempty :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). PInner (t k v) ~ PAssocMap k v => Term s (t k v) Source #
Construct an empty map.
Since: 2.0.0
psingleton :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PInner (t k v) ~ PAssocMap k v, PIsData k, PIsData v) => Term s (k :--> (v :--> t k v)) Source #
Construct a singleton map with the given key and value.
Since: 2.1.1
psingletonData :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). PInner (t k v) ~ PAssocMap k v => Term s (PAsData k :--> (PAsData v :--> t k v)) Source #
Construct a singleton map with the given data-encoded key and value.
Since: 2.1.1
punsortedMapFromFoldable :: forall (k :: S -> Type) (v :: S -> Type) f (s :: S). (Foldable f, PIsData k, PIsData v) => f (Term s k, Term s v) -> Term s (PUnsortedMap k v) Source #
Since: 2.1.1
psortedMapFromFoldable :: forall (k :: S -> Type) (v :: S -> Type) f (s :: S). (Foldable f, POrd k, PIsData k, PIsData v) => f (Term s k, Term s v) -> Term s (PSortedMap k v) Source #
Since: 2.1.1
Transformation
passertSorted :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s (PUnsortedMap k v :--> PSortedMap k v) Source #
Deprecated: Use ppromoteToSortedMap instead
Attempt to promote PUnsortedMap to PSortedMap. This function checks
that the keys in the input map are in strictly ascending order and fails with
an error if they are not. Duplicate keys are not allowed.
Since: 2.0.0
ppromoteToSortedMap :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s (PUnsortedMap k v :--> PSortedMap k v) Source #
Attempt to promote PUnsortedMap to PSortedMap. This function checks
that the keys in the input map are in strictly ascending order and fails with
an error if they are not. Duplicate keys are not allowed.
Since: 3.6.0
punsafeCoerceToSortedMap :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PUnsortedMap k v) -> Term s (PSortedMap k v) Source #
Coerce PUnsortedMap to PSortedMap. Unsafe.
Since: 3.6.0
pforgetSorted :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PSortedMap k v) -> Term s (PUnsortedMap k v) Source #
Forget the knowledge that keys were sorted.
Since: 2.1.1
pmap :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData a, PIsData b) => Term s ((a :--> b) :--> (t k a :--> t k b)) Source #
Applies a function to every value in the map, much like map.
Since: 2.0.0
pmapData :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b) => Term s ((PAsData a :--> PAsData b) :--> (t k a :--> t k b)) Source #
As pmap, but over Data representations.
Since: 2.0.0
pmapWithKey :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData k, PIsData a, PIsData b) => Term s ((k :--> (a :--> b)) :--> (t k a :--> t k b)) Source #
As pmap, but gives key access as well.
Since: 2.1.1
pmapMaybe :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData a, PIsData b) => Term s ((a :--> PMaybe b) :--> (t k a :--> t k b)) Source #
Maps and filters the map, much like mapMaybe.
Since: 2.0.0
pmapMaybeData :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b) => Term s ((PAsData a :--> PMaybe (PAsData b)) :--> (t k a :--> t k b)) Source #
As pmapMaybe, but over Data representation.
Since: 2.0.0
pmapMaybeWithKey :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b, PIsData k, PIsData a, PIsData b) => Term s ((k :--> (a :--> PMaybe b)) :--> (t k a :--> t k b)) Source #
As pmapMaybe, but gives key access as well.
Since: 3.5.0
pmapMaybeDataWithKey :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PInner (t k a) ~ PAssocMap k a, PInner (t k b) ~ PAssocMap k b) => Term s ((PAsData k :--> (PAsData a :--> PMaybe (PAsData b))) :--> (t k a :--> t k b)) Source #
As pmapMaybeData, but gives key access as well.
Since: 3.5.0
Relational lift
pcheckBinRel :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> PBool)) :--> (v :--> (PSortedMap k v :--> (PSortedMap k v :--> PBool)))) Source #
Given a comparison function and a "zero" value, check whether a binary
relation holds over two PSortedMaps.
Important note
This is primarily intended to be used with PValue. We assume that the comparison behaves like
a comparison would (thus, being at least a partial order, or possibly a total order or
equivalence), and that the starting value does not break it. Use with extreme care.
Since: 2.0.0
Comparison
pkeysEqual :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PEq k, PIsData k) => Term s (PSortedMap k a :--> (PSortedMap k b :--> PBool)) Source #
Gives PTrue if both argument PSortedMaps contain mappings for exactly
the same set of keys. Requires a number of equality comparisons between keys
proportional to the length of the shorter argument.
Since: 2.1.1
pkeysEqualUnsorted :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (PIsData k, PIsData a, PIsData b) => Term s (PUnsortedMap k a :--> (PUnsortedMap k b :--> PBool)) Source #
As pkeysEqual, but requires only PEq constraints for the keys, and
works for PUnsortedMaps. This requires a number of equality comparisons
between keys proportional to the product of the lengths of both arguments:
that is, this function is quadratic.
NOTE
This function does not handle duplicate keys in unsorted maps. For example, if
one map contains duplicate keys while the other does not, the function may still
return PTrue as long as each key appears at least once in both maps.
Use with caution - or preferably avoid using this function entirely - as it may be deprecated in a future release due to its non-obvious behavior.
Since: 2.1.1
Fold
pall :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData v => Term s ((v :--> PBool) :--> (PUnsortedMap k v :--> PBool)) Source #
Verifies all values in the map satisfy the given predicate.
Since: 2.0.0
pany :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData v => Term s ((v :--> PBool) :--> (PUnsortedMap k v :--> PBool)) Source #
Tests if any value in the map satisfies the given predicate.
Since: 2.1.1
pfoldMapWithKey :: forall (m :: S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v, forall (s' :: S). Monoid (Term s' m)) => Term s ((k :--> (v :--> m)) :--> (PUnsortedMap k v :--> m)) Source #
Project all key-value pairs into a Monoid, then combine. Keys and values
will be presented in key order.
Since: 3.6.0
pfoldlWithKey :: forall (a :: S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s ((a :--> (k :--> (v :--> a))) :--> (a :--> (PUnsortedMap k v :--> a))) Source #
Left-associative fold with keys. Keys and values will be presented in key order.
Since: 3.6.0
Combination
zipWithBuilder :: forall (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type). (POrd k, PIsData k, PIsData a, PIsData b, PIsData c) => MergeHandler s k a b c -> Term s (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c)) Source #
Build a function that zips two PSortedMaps together using a custom MergeHandler.
The provided MergeHandler determines how to merge entries based on whether a
key is present in the left map, the right map, or both.
NOTE
This function itself cannot be hoisted with phoistAcyclic because it
depends on the supplied MergeHandler. However, once you specialize it
by providing a specific merge handler, the resulting function should be
hoisted if it will be reused, to avoid duplication.
Since: 3.5.0
zipWithDataBuilder :: forall (s :: S) (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type). (POrd k, PIsData k) => MergeHandler s (PAsData k) (PAsData a) (PAsData b) (PAsData c) -> Term s (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c)) Source #
Build a function that zips two PSortedMaps together using a custom MergeHandler.
The provided MergeHandler determines how to merge entries based on whether a
key is present in the left map, the right map, or both.
Unlike zipWithBuilder, zipWithDataBuilder operates on values wrapped in
PAsData (typed BuiltinData).
NOTE
This function itself cannot be hoisted with phoistAcyclic because it
depends on the supplied MergeHandler. However, once you specialize it
by providing a specific merge handler, the resulting function should be
hoisted if it will be reused, to avoid duplication.
Since: 3.5.0
punionWith :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> v)) :--> (PSortedMap k v :--> (PSortedMap k v :--> PSortedMap k v))) Source #
Build the union of two PSortedMaps, merging values that share the same
key using the given function.
Since: 3.5.0
punionWithData :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s ((PAsData v :--> (PAsData v :--> PAsData v)) :--> (PSortedMap k v :--> (PSortedMap k v :--> PSortedMap k v))) Source #
Build the union of two PSortedMaps, merging values that share the same
key using the given function.
Since: 3.5.0
pleftBiasedUnion :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s (PSortedMap k v :--> (PSortedMap k v :--> PSortedMap k v)) Source #
Build the union of two PSortedMaps. Take the value from the left argument
for colliding keys.
Since: 2.1.1
pdifference :: forall (b :: S -> Type) (a :: S -> Type) (k :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b) => Term s (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k a)) Source #
pdifferenceWith :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b) => Term s ((a :--> (b :--> PMaybe a)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k a))) Source #
pzipWithDefaults :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b, PIsData c) => (forall (s' :: S). Term s' a) -> (forall (s' :: S). Term s' b) -> Term s ((a :--> (b :--> c)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c))) Source #
Zip two PSortedMaps, using the given value merge function for key
collisions, and different values for the sides.
Since: 2.1.1
pintersectionWith :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData a, PIsData b, PIsData c) => Term s ((a :--> (b :--> c)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c))) Source #
Build the intersection of two PSortedMaps, merging values that share the
same key using the given function.
Since: 2.1.1
pintersectionWithData :: forall (k :: S -> Type) (a :: S -> Type) (b :: S -> Type) (c :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s ((PAsData a :--> (PAsData b :--> PAsData c)) :--> (PSortedMap k a :--> (PSortedMap k b :--> PSortedMap k c))) Source #
Build the intersection of two PSortedMaps, merging data-encoded values
that share the same key using the given function.
Since: 2.1.1
Query
pnull :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PUnsortedMap k v :--> PBool) Source #
Tests whether the map is empty.
Since: 2.0.0
plookup :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s (k :--> (PSortedMap k v :--> PMaybe v)) Source #
Look up the given key in a PSortedMap.
Since: 3.6.0
plookupData :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). Term s (PAsData k :--> (PSortedMap k v :--> PMaybe (PAsData v))) Source #
As plookup, except over Data representation.
Since: 3.6.0
plookupDataWith :: forall (k :: S -> Type) (v :: S -> Type) (x :: S -> Type) (s :: S). Term s ((PBuiltinPair (PAsData k) (PAsData v) :--> PMaybe x) :--> (PAsData k :--> (PSortedMap k v :--> PMaybe x))) Source #
Look up the given key data in a PSortedMap, applying the given function
to the found key-value pair.
Since: 3.6.0
pfindWithDefault :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s (v :--> (k :--> (PSortedMap k v :--> v))) Source #
Look up the given key in a PSortedMap, returning the default value
if the key is absent.
Since: 3.6.0
pfoldAt :: forall (k :: S -> Type) (v :: S -> Type) (r :: S -> Type) (s :: S). PIsData k => Term s (k :--> (r :--> ((PAsData v :--> r) :--> (PSortedMap k v :--> r)))) Source #
Look up the given key in a PSortedMap; return the default if the key is
absent or apply the argument function to the value data if present.
Since: 3.6.0
pfoldAtData :: forall (k :: S -> Type) (v :: S -> Type) (r :: S -> Type) (s :: S). Term s (PAsData k :--> (r :--> ((PAsData v :--> r) :--> (PSortedMap k v :--> r)))) Source #
Look up the given key data in a PSortedMap; return the default if the key
is absent or apply the argument function to the value data if present.
Since: 3.6.0
ptryLookup :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v) => Term s (k :--> (PSortedMap k v :--> v)) Source #
As plookup, but errors when the key is missing.
Since: 3.6.0
Modification
pinsert :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k, PIsData v) => Term s (k :--> (v :--> (PSortedMap k v :--> PSortedMap k v))) Source #
Insert a new key/value pair into the map, overriding the previous if any.
Since: 2.1.1
pdelete :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (POrd k, PIsData k) => Term s (k :--> (PSortedMap k v :--> PSortedMap k v)) Source #
Delete a key from the map.
Since: 2.1.1
pupdate :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, PIsData v, POrd k) => Term s ((v :--> PMaybe v) :--> (k :--> (PSortedMap k v :--> PSortedMap k v))) Source #
Given an 'updater' and a key, if the key exists in the PMap, apply the
'updater' to it, otherwise do nothing. If the 'updater' produces
PNothing, the value is deleted; otherwise, it is modified to the result.
Performance will be equivalent to a lookup followed by an insert (or delete), as well as the cost of calling the 'updater'.
Since: 2.1.1
padjust :: forall (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PInner (t k v) ~ PAssocMap k v, PIsData k, PEq k, PIsData v) => Term s ((v :--> v) :--> (k :--> (t k v :--> t k v))) Source #
If a value exists at the specified key, apply the function argument to it; otherwise, do nothing.
Since: 2.1.1
Key-value pair manipulation
pkvPairKey :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData k => Term s (PBuiltinPair (PAsData k) (PAsData v) :--> k) Source #
Get the key of a key-value pair.
Since: 2.1.1
pkvPairValue :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). PIsData v => Term s (PBuiltinPair (PAsData k) (PAsData v) :--> v) Source #
Get the value of a key-value pair.
Since: 2.1.1
pkvPairLt :: forall (k :: S -> Type) (v :: S -> Type) (s :: S). (PIsData k, POrd k) => Term s (PBuiltinPair (PAsData k) (PAsData v) :--> (PBuiltinPair (PAsData k) (PAsData v) :--> PBool)) Source #
Compare two key-value pairs by their keys. Gives PTrue if the key of the
first argument pair is less than the key of the second argument pair.
Since: 2.1.1
Conversion
pkeys :: forall (ell :: (S -> Type) -> S -> Type) (t :: (S -> Type) -> (S -> Type) -> S -> Type) (k :: S -> Type) (v :: S -> Type) (s :: S). (PInner (t k v) ~ PAssocMap k v, PListLike ell, PElemConstraint ell (PAsData k)) => Term s (t k v :--> ell (PAsData k)) Source #
Extract the keys from the given PIsAssocMap instance as a list-like
structure. If the provided Map is PSortedMap, the keys will maintain that
order, and will be unique; otherwise, the order is unspecified, and duplicates
may exist.
Note
You will need to specify what manner of list-like structure you want; we have
arranged the type signature to make specifying this easy with
TypeApplications.
Since: 2.1.1