Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype BackendMap (i :: BackendType -> Type) = BackendMap (Map BackendType (AnyBackend i))
- singleton :: forall b i. HasTag b => i b -> BackendMap i
- lookup :: forall (b :: BackendType) i. HasTag b => BackendMap i -> Maybe (i b)
- elems :: forall i. BackendMap i -> [AnyBackend i]
- modify :: forall b i. (HasTag b, Monoid (i b)) => (i b -> i b) -> BackendMap i -> BackendMap i
- alter :: forall b i. HasTag b => (Maybe (i b) -> Maybe (i b)) -> BackendMap i -> BackendMap i
Documentation
newtype BackendMap (i :: BackendType -> Type) Source #
A BackendMap is a data structure that can contain at most one value of an i
per BackendType
The i
type must be one that is parameterized by a BackendType-kinded type parameter
BackendMap (Map BackendType (AnyBackend i)) |
Instances
singleton :: forall b i. HasTag b => i b -> BackendMap i Source #
lookup :: forall (b :: BackendType) i. HasTag b => BackendMap i -> Maybe (i b) Source #
Get a value from the map for the particular BackendType
b
. This function
is usually used with a type application.
lookup
('Postgres 'Vanilla) backendMap
@
elems :: forall i. BackendMap i -> [AnyBackend i] Source #
Get all values in the map
modify :: forall b i. (HasTag b, Monoid (i b)) => (i b -> i b) -> BackendMap i -> BackendMap i Source #
The expression modify f bmap
alters the value x
at
b
. modify
is a restricted version of alter
which cannot
delete entries and if there is no b
key present in the map, it
will apply the modification function to the i b
unit value and
insert the result at b
.
alter :: forall b i. HasTag b => (Maybe (i b) -> Maybe (i b)) -> BackendMap i -> BackendMap i Source #
The expression alter f bmap
alters the value x
at b
, or
absence thereof. alter can be used to insert, delete, or update a
value in a Map.
In short : lookup k (alter f k m) = f (lookup k m)
.