Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data KVStore k v m a where
- lookupKV :: forall k v r. Member (KVStore k v) r => k -> Sem r (Maybe v)
- lookupOrThrowKV :: Members '[KVStore k v, Error e] r => (k -> e) -> k -> Sem r v
- existsKV :: forall k v r. Member (KVStore k v) r => k -> Sem r Bool
- writeKV :: Member (KVStore k v) r => k -> v -> Sem r ()
- deleteKV :: forall k v r. Member (KVStore k v) r => k -> Sem r ()
- updateKV :: forall k v r. Member (KVStore k v) r => k -> Maybe v -> Sem r ()
- modifyKV :: Member (KVStore k v) r => v -> (v -> v) -> k -> Sem r ()
- runKVStoreAsState :: Ord k => Sem (KVStore k v ': r) a -> Sem (State (Map k v) ': r) a
- runKVStorePure :: Ord k => Map k v -> Sem (KVStore k v ': r) a -> Sem r (Map k v, a)
- runKVStoreAsKVStore :: forall k v k' v' r a. (k -> k') -> (v -> v') -> (v' -> v) -> Sem (KVStore k v ': r) a -> Sem (KVStore k' v' ': r) a
- runKVStoreAsKVStoreSem :: forall k v k' v' r a. Members '[KVStore k' v'] r => (k -> Sem r k') -> (v -> Sem r v') -> (v' -> Sem r v) -> Sem (KVStore k v ': r) a -> Sem r a
Effect
data KVStore k v m a where Source #
Models things like Redis, HTTP GET/POST, etc. Things that are keyed, have a value, and may or may not be there.
Actions
lookupOrThrowKV :: Members '[KVStore k v, Error e] r => (k -> e) -> k -> Sem r v Source #
Since: 0.1.0.0
Since: 0.1.0.0
Interpreters
runKVStorePure :: Ord k => Map k v -> Sem (KVStore k v ': r) a -> Sem r (Map k v, a) Source #
Run a KVStore
purely as a Map
.
Since: 0.1.0.0
:: forall k v k' v' r a. (k -> k') | A function to transform the key into the interpreted key. |
-> (v -> v') | A function to transform the value into the interpreted value. |
-> (v' -> v) | A function to transform the interpreted key back into the current value. |
-> Sem (KVStore k v ': r) a | |
-> Sem (KVStore k' v' ': r) a |
runKVStoreAsKVStoreSem Source #
:: forall k v k' v' r a. Members '[KVStore k' v'] r | |
=> (k -> Sem r k') | A function to transform the key into the interpreted key. |
-> (v -> Sem r v') | A function to transform the value into the interpreted value. |
-> (v' -> Sem r v) | A function to transform the interpreted value back into the current value. |
-> Sem (KVStore k v ': r) a | |
-> Sem r a |