Module

Cardano.Plutus.Types.Map

#Map

newtype Map (k :: Type) (v :: Type)

A Plutus-style associated list Map of key-value pairs.

Constructors

Instances

#delete

delete :: forall (k :: Type) (v :: Type). Eq k => k -> Map k v -> Map k v

Delete a key in a Map

#elems

elems :: forall (k :: Type) (v :: Type). Map k v -> Array v

Return all elements of the map in the ascending order of their keys.

#empty

empty :: forall (k :: Type) (v :: Type). Map k v

An empty Map

#filter

filter :: forall (k :: Type) (v :: Type). (v -> Boolean) -> Map k v -> Map k v

Filter all values that satisfy the predicate.

#insert

insert :: forall k v. Eq k => k -> v -> Map k v -> Map k v

#keys

keys :: forall (k :: Type) (v :: Type). Map k v -> Array k

The keys of a Map

#lookup

lookup :: forall (k :: Type) (v :: Type). Eq k => k -> Map k v -> Maybe v

Find an entry in a Map.

#mapMaybe

mapMaybe :: forall (k :: Type) (a :: Type) (b :: Type). (a -> Maybe b) -> Map k a -> Map k b

Map values and collect the Just results.

#mapMaybeWithKey

mapMaybeWithKey :: forall (k :: Type) (a :: Type) (b :: Type). (k -> a -> Maybe b) -> Map k a -> Map k b

Map keys, values and collect the Just results.

#mapThese

mapThese :: forall (k :: Type) (v :: Type) (a :: Type) (b :: Type). (v -> These a b) -> Map k v -> ((Map k a) /\ (Map k b))

A version of Haskell's Data.Map.Lazy.mapEither that works with These

#member

member :: forall (k :: Type) (v :: Type). Eq k => k -> Map k v -> Boolean

Whether given key is a member of a Map

#null

null :: forall (k :: Type) (v :: Type). Map k v -> Boolean

Checks whether a Map is empty

#singleton

singleton :: forall (k :: Type) (v :: Type). k -> v -> Map k v

A singleton Map

#union

union :: forall (k :: Type) (v :: Type) (r :: Type). Eq k => Map k v -> Map k r -> Map k (These v r)

Combine two Maps

#unionWith

unionWith :: forall (k :: Type) (a :: Type). Eq k => (a -> a -> a) -> Map k a -> Map k a -> Map k a

Combine two Maps with the given combination function

#values

values :: forall (k :: Type) (v :: Type). Map k v -> Array v

The values of a Map

#fromCardano

fromCardano :: forall k v. Map k v -> Map k v

#toCardano

toCardano :: forall k v. Ord k => Map k v -> Maybe (Map k v)

Fails with Nothing if there are duplicates

Modules