Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data BackendMap (i :: BackendType -> Type)
- lookupD :: forall (b :: BackendType) (i :: BackendType -> Type). HasTag b => Dependency (BackendMap i) -> Dependency (Maybe (i b))
- 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
- overridesDeeply :: i `SatisfiesForAllBackends` Semigroup => BackendMap i -> BackendMap i -> BackendMap i
Documentation
data 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
Instances
lookupD :: forall (b :: BackendType) (i :: BackendType -> Type). HasTag b => Dependency (BackendMap i) -> Dependency (Maybe (i b)) Source #
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)
.
overridesDeeply :: i `SatisfiesForAllBackends` Semigroup => BackendMap i -> BackendMap i -> BackendMap i Source #
The expression a `overridesDeeply b
applies the values from a
on top of the defaults b
.
In practice this should union the maps for each backend type.