Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data KVStore k v :: Effect where
- lookupKV :: KVStore k v :> es => k -> Eff es (Maybe v)
- updateKV :: KVStore k v :> es => k -> Maybe v -> Eff es ()
- writeKV :: KVStore k v :> es => k -> v -> Eff es ()
- deleteKV :: forall k v es. KVStore k v :> es => k -> Eff es ()
- lookupOrThrowKV :: '[KVStore k v, Error e] :>> es => (k -> e) -> k -> Eff es v
- existsKV :: forall k v es. KVStore k v :> es => k -> Eff es Bool
- adjustKV :: forall k v es. KVStore k v :> es => (v -> v) -> k -> Eff es ()
- modifyKV :: forall k v es. KVStore k v :> es => (v -> Maybe v) -> k -> Eff es ()
- alterKV :: forall k v es. KVStore k v :> es => (Maybe v -> Maybe v) -> k -> Eff es ()
- kvStoreToMapState :: Ord k => Eff (KVStore k v ': es) ~> Eff (State (Map k v) ': es)
- kvStoreToLazyMapState :: Ord k => Eff (KVStore k v ': es) ~> Eff (State (Map k v) ': es)
- kvStoreToIntMapState :: Eff (KVStore Key v ': es) ~> Eff (State (IntMap v) ': es)
- kvStoreToLazyIntMapState :: Eff (KVStore Key v ': es) ~> Eff (State (IntMap v) ': es)
- kvStoreToHashMapState :: (Hashable k, Eq k) => Eff (KVStore k v ': es) ~> Eff (State (HashMap k v) ': es)
- kvStoreToLazyHashMapState :: (Hashable k, Eq k) => Eff (KVStore k v ': es) ~> Eff (State (HashMap k v) ': es)
Effect
data KVStore k v :: Effect where Source #
An effect that provides operations of accessing a key-value store, like a map data structure or a key-value database.
Operations
lookupOrThrowKV :: '[KVStore k v, Error e] :>> es => (k -> e) -> k -> Eff es v Source #
Lookup the value of the given key, if not found, then throw some error.
existsKV :: forall k v es. KVStore k v :> es => k -> Eff es Bool Source #
Sees if the key is present in the store.
adjustKV :: forall k v es. KVStore k v :> es => (v -> v) -> k -> Eff es () Source #
If the key is present, changes the value via a function.
modifyKV :: forall k v es. KVStore k v :> es => (v -> Maybe v) -> k -> Eff es () Source #
If the key is present, updates the entry (potentially deleting it) via a function.
alterKV :: forall k v es. KVStore k v :> es => (Maybe v -> Maybe v) -> k -> Eff es () Source #
Updates the entry via a function, no matter the key is present or not.