Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- newtype PMap (keysort :: KeyGuarantees) (k :: PType) (v :: PType) (s :: S) = PMap (Term s (PBuiltinList (PBuiltinPair (PAsData k) (PAsData v))))
- data KeyGuarantees
- pempty :: Term s (PMap 'Sorted k v)
- psingleton :: (PIsData k, PIsData v) => Term s (k :--> (v :--> PMap 'Sorted k v))
- psingletonData :: Term s (PAsData k :--> (PAsData v :--> PMap 'Sorted k v))
- pinsert :: (POrd k, PIsData k, PIsData v) => Term s (k :--> (v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v)))
- pinsertData :: (POrd k, PIsData k) => Term s (PAsData k :--> (PAsData v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v)))
- pdelete :: (POrd k, PIsData k) => Term s (k :--> (PMap 'Sorted k v :--> PMap 'Sorted k v))
- pfromAscList :: (POrd k, PIsData k, PIsData v) => Term s (PBuiltinListOfPairs k v :--> PMap 'Sorted k v)
- passertSorted :: forall k v any s. (POrd k, PIsData k, PIsData v) => Term s (PMap any k v :--> PMap 'Sorted k v)
- pforgetSorted :: Term s (PMap 'Sorted k v) -> Term s (PMap g k v)
- plookup :: (PIsData k, PIsData v) => Term s (k :--> (PMap any k v :--> PMaybe v))
- plookupData :: Term s (PAsData k :--> (PMap any k v :--> PMaybe (PAsData v)))
- pfindWithDefault :: (PIsData k, PIsData v) => Term s (v :--> (k :--> (PMap any k v :--> v)))
- pfoldAt :: PIsData k => Term s (k :--> (r :--> ((PAsData v :--> r) :--> (PMap any k v :--> r))))
- pnull :: Term s (PMap any k v :--> PBool)
- pall :: PIsData v => Term s ((v :--> PBool) :--> (PMap any k v :--> PBool))
- pany :: PIsData v => Term s ((v :--> PBool) :--> (PMap any k v :--> PBool))
- pfilter :: PIsData v => Term s ((v :--> PBool) :--> (PMap g k v :--> PMap g k v))
- pmap :: (PIsData a, PIsData b) => Term s ((a :--> b) :--> (PMap g k a :--> PMap g k b))
- pmapData :: Term s ((PAsData a :--> PAsData b) :--> (PMap g k a :--> PMap g k b))
- pmapMaybe :: (PIsData a, PIsData b) => Term s ((a :--> PMaybe b) :--> (PMap g k a :--> PMap g k b))
- pmapMaybeData :: Term s ((PAsData a :--> PMaybe (PAsData b)) :--> (PMap g k a :--> PMap g k b))
- pdifference :: PIsData k => Term s (PMap g k a :--> (PMap any k b :--> PMap g k a))
- punionWith :: (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> v)) :--> (PMap 'Sorted k v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v)))
- punionWithData :: (POrd k, PIsData k) => Term s ((PAsData v :--> (PAsData v :--> PAsData v)) :--> (PMap 'Sorted k v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v)))
- pcheckBinRel :: forall k v s. (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> PBool)) :--> (v :--> (PMap 'Sorted k v :--> (PMap 'Sorted k v :--> PBool))))
Documentation
newtype PMap (keysort :: KeyGuarantees) (k :: PType) (v :: PType) (s :: S) Source #
PMap (Term s (PBuiltinList (PBuiltinPair (PAsData k) (PAsData v)))) |
Instances
Creation
psingleton :: (PIsData k, PIsData v) => Term s (k :--> (v :--> PMap 'Sorted k v)) Source #
Construct a singleton PMap
with the given key and value.
psingletonData :: Term s (PAsData k :--> (PAsData v :--> PMap 'Sorted k v)) Source #
Construct a singleton PMap
with the given data-encoded key and value.
pinsert :: (POrd k, PIsData k, PIsData v) => Term s (k :--> (v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v))) Source #
Insert a new key/value pair into the map, overiding the previous if any.
pinsertData :: (POrd k, PIsData k) => Term s (PAsData k :--> (PAsData v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v))) Source #
Insert a new data-encoded key/value pair into the map, overiding the previous if any.
pdelete :: (POrd k, PIsData k) => Term s (k :--> (PMap 'Sorted k v :--> PMap 'Sorted k v)) Source #
Delete a key from the map.
pfromAscList :: (POrd k, PIsData k, PIsData v) => Term s (PBuiltinListOfPairs k v :--> PMap 'Sorted k v) Source #
Construct a PMap
from a list of key-value pairs, sorted by ascending key data.
passertSorted :: forall k v any s. (POrd k, PIsData k, PIsData v) => Term s (PMap any k v :--> PMap 'Sorted k v) Source #
Assert the map is properly sorted.
pforgetSorted :: Term s (PMap 'Sorted k v) -> Term s (PMap g k v) Source #
Forget the knowledge that keys were sorted.
Lookups
plookup :: (PIsData k, PIsData v) => Term s (k :--> (PMap any k v :--> PMaybe v)) Source #
Look up the given key in a PMap
.
plookupData :: Term s (PAsData k :--> (PMap any k v :--> PMaybe (PAsData v))) Source #
Look up the given key data in a PMap
.
pfindWithDefault :: (PIsData k, PIsData v) => Term s (v :--> (k :--> (PMap any k v :--> v))) Source #
Look up the given key in a PMap
, returning the default value if the key is absent.
pfoldAt :: PIsData k => Term s (k :--> (r :--> ((PAsData v :--> r) :--> (PMap any k v :--> r)))) Source #
Look up the given key in a PMap
; return the default if the key is
absent or apply the argument function to the value data if present.
Folds
pall :: PIsData v => Term s ((v :--> PBool) :--> (PMap any k v :--> PBool)) Source #
Tests if all values in the map satisfy the given predicate.
pany :: PIsData v => Term s ((v :--> PBool) :--> (PMap any k v :--> PBool)) Source #
Tests if anu value in the map satisfies the given predicate.
Filters and traversals
pfilter :: PIsData v => Term s ((v :--> PBool) :--> (PMap g k v :--> PMap g k v)) Source #
Filters the map so it contains only the values that satisfy the given predicate.
pmap :: (PIsData a, PIsData b) => Term s ((a :--> b) :--> (PMap g k a :--> PMap g k b)) Source #
Applies a function to every value in the map, much like map
.
pmapMaybe :: (PIsData a, PIsData b) => Term s ((a :--> PMaybe b) :--> (PMap g k a :--> PMap g k b)) Source #
Maps and filters the map, much like mapMaybe
.
pmapMaybeData :: Term s ((PAsData a :--> PMaybe (PAsData b)) :--> (PMap g k a :--> PMap g k b)) Source #
Combining
pdifference :: PIsData k => Term s (PMap g k a :--> (PMap any k b :--> PMap g k a)) Source #
Difference of two maps. Return elements of the first map not existing in the second map.
punionWith :: (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> v)) :--> (PMap 'Sorted k v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v))) Source #
Combine two PMap
s applying the given function to any two values that
share the same key.
punionWithData :: (POrd k, PIsData k) => Term s ((PAsData v :--> (PAsData v :--> PAsData v)) :--> (PMap 'Sorted k v :--> (PMap 'Sorted k v :--> PMap 'Sorted k v))) Source #
Combine two PMap
s applying the given function to any two data-encoded
values that share the same key.
Partial order operations
pcheckBinRel :: forall k v s. (POrd k, PIsData k, PIsData v) => Term s ((v :--> (v :--> PBool)) :--> (v :--> (PMap 'Sorted k v :--> (PMap 'Sorted k v :--> PBool)))) Source #
Given a comparison function and a "zero" value, check whether a binary relation holds over
2 sorted PMap
s.
This is primarily intended to be used with PValue
.
Orphan instances
(PConstantData k, PConstantData v, Ord k) => PConstantDecl (Map k v) Source # | |
type PConstantRepr (Map k v) Source # type PConstanted (Map k v) :: PType Source # pconstantToRepr :: Map k v -> PConstantRepr (Map k v) Source # pconstantFromRepr :: PConstantRepr (Map k v) -> Maybe (Map k v) Source # |