Safe Haskell | None |
---|---|
Language | Haskell2010 |
Instructions to work with UStore
.
Synopsis
- unsafeEmptyUStore :: forall store s. s :-> (UStore store ': s)
- ustoreMem :: forall store name s. KeyAccessC store name => Label name -> (GetUStoreKey store name ': (UStore store ': s)) :-> (Bool ': s)
- ustoreGet :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (GetUStoreKey store name ': (UStore store ': s)) :-> (Maybe (GetUStoreValue store name) ': s)
- ustoreUpdate :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (GetUStoreKey store name ': (Maybe (GetUStoreValue store name) ': (UStore store ': s))) :-> (UStore store ': s)
- ustoreInsert :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (GetUStoreKey store name ': (GetUStoreValue store name ': (UStore store ': s))) :-> (UStore store ': s)
- ustoreInsertNew :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (forall s0 any. (GetUStoreKey store name ': s0) :-> any) -> (GetUStoreKey store name ': (GetUStoreValue store name ': (UStore store ': s))) :-> (UStore store ': s)
- ustoreDelete :: forall store name s. KeyAccessC store name => Label name -> (GetUStoreKey store name ': (UStore store ': s)) :-> (UStore store ': s)
- ustoreToField :: forall store name s. FieldAccessC store name => Label name -> (UStore store ': s) :-> (GetUStoreField store name ': s)
- ustoreGetField :: forall store name s. FieldAccessC store name => Label name -> (UStore store ': s) :-> (GetUStoreField store name ': (UStore store ': s))
- ustoreSetField :: forall store name s. FieldAccessC store name => Label name -> (GetUStoreField store name ': (UStore store ': s)) :-> (UStore store ': s)
- ustoreRemoveFieldUnsafe :: forall store name s. FieldAccessC store name => Label name -> (UStore store ': s) :-> (UStore store ': s)
- type HasUStore name key value store = (KeyAccessC store name, ValueAccessC store name, GetUStoreKey store name ~ key, GetUStoreValue store name ~ value)
- type HasUField name ty store = (FieldAccessC store name, GetUStoreField store name ~ ty)
- type HasUStoreForAllIn store constrained = (Generic store, GHasStoreForAllIn constrained (Rep store))
- packSubMapUKey :: forall (field :: Symbol) k s. (KnownSymbol field, NicePackedValue k) => (k ': s) :-> (ByteString ': s)
Documentation
unsafeEmptyUStore :: forall store s. s :-> (UStore store ': s) Source #
Put an empty UStore
onto the stack. This function is generally unsafe:
if store template contains a UStoreField
, the resulting UStore
is not
immediately usable.
If you are sure that UStore
contains only submaps, feel free to just use
the result of this function. Otherwise you must set all fields.
ustoreMem :: forall store name s. KeyAccessC store name => Label name -> (GetUStoreKey store name ': (UStore store ': s)) :-> (Bool ': s) Source #
ustoreGet :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (GetUStoreKey store name ': (UStore store ': s)) :-> (Maybe (GetUStoreValue store name) ': s) Source #
ustoreUpdate :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (GetUStoreKey store name ': (Maybe (GetUStoreValue store name) ': (UStore store ': s))) :-> (UStore store ': s) Source #
ustoreInsert :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (GetUStoreKey store name ': (GetUStoreValue store name ': (UStore store ': s))) :-> (UStore store ': s) Source #
ustoreInsertNew :: forall store name s. (KeyAccessC store name, ValueAccessC store name) => Label name -> (forall s0 any. (GetUStoreKey store name ': s0) :-> any) -> (GetUStoreKey store name ': (GetUStoreValue store name ': (UStore store ': s))) :-> (UStore store ': s) Source #
Insert a key-value pair, but fail if it will overwrite some existing entry.
ustoreDelete :: forall store name s. KeyAccessC store name => Label name -> (GetUStoreKey store name ': (UStore store ': s)) :-> (UStore store ': s) Source #
ustoreToField :: forall store name s. FieldAccessC store name => Label name -> (UStore store ': s) :-> (GetUStoreField store name ': s) Source #
ustoreGetField :: forall store name s. FieldAccessC store name => Label name -> (UStore store ': s) :-> (GetUStoreField store name ': (UStore store ': s)) Source #
ustoreSetField :: forall store name s. FieldAccessC store name => Label name -> (GetUStoreField store name ': (UStore store ': s)) :-> (UStore store ': s) Source #
Like setField
, but for UStore
.
ustoreRemoveFieldUnsafe :: forall store name s. FieldAccessC store name => Label name -> (UStore store ': s) :-> (UStore store ': s) Source #
Remove a field from UStore
, for internal purposes only.
Instruction constraints
type HasUStore name key value store = (KeyAccessC store name, ValueAccessC store name, GetUStoreKey store name ~ key, GetUStoreValue store name ~ value) Source #
This constraint can be used if a function needs to work with big store, but needs to know only about some submap(s) of it.
It can use all UStore operations for a particular name, key and value without knowing whole template.
type HasUField name ty store = (FieldAccessC store name, GetUStoreField store name ~ ty) Source #
This constraint can be used if a function needs to work with big store, but needs to know only about some field of it.
type HasUStoreForAllIn store constrained = (Generic store, GHasStoreForAllIn constrained (Rep store)) Source #
Write down all sensisble constraints which given store
satisfies
and apply them to constrained
.
This store should have |~>
and UStoreField
fields in its immediate fields,
no deep inspection is performed.
Internals
packSubMapUKey :: forall (field :: Symbol) k s. (KnownSymbol field, NicePackedValue k) => (k ': s) :-> (ByteString ': s) Source #