| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Data.GenericCache
Synopsis
- data GenericCache
- class HasGenericCache a where
- anyLens :: forall a s. (HasGenericCache s, Typeable a, HasCallStack) => a -> Lens' s a
- maybeLens :: forall a s. (HasGenericCache s, Typeable a) => Lens' s (Maybe a)
- atLens :: forall k v s. (HasGenericCache s, Typeable k, Ord k, Typeable v, HasCallStack) => k -> Lens' s (Maybe v)
- mapLens :: forall k v s. (HasGenericCache s, Typeable k, Ord k, Typeable v, HasCallStack) => Lens' s (Map k v)
- tests :: Test
Cache type
data GenericCache #
A map from a type fingerprint (SomeTypeRep) to a wrapped value (Dynamic) of that type.
Instances
| Generic GenericCache # | |
Defined in Data.GenericCache Associated Types type Rep GenericCache :: Type -> Type # | |
| Semigroup GenericCache # | |
Defined in Data.GenericCache Methods (<>) :: GenericCache -> GenericCache -> GenericCache # sconcat :: NonEmpty GenericCache -> GenericCache # stimes :: Integral b => b -> GenericCache -> GenericCache # | |
| Monoid GenericCache # | |
Defined in Data.GenericCache Methods mempty :: GenericCache # mappend :: GenericCache -> GenericCache -> GenericCache # mconcat :: [GenericCache] -> GenericCache # | |
| HasGenericCache GenericCache # | |
Defined in Data.GenericCache Methods | |
| type Rep GenericCache # | |
Defined in Data.GenericCache type Rep GenericCache = D1 (MetaData "GenericCache" "Data.GenericCache" "generic-cache-1.1-inplace" True) (C1 (MetaCons "GenericCache" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map SomeTypeRep Dynamic)))) | |
class HasGenericCache a where #
How to find the GenericCache value.
Methods
genericCache :: Lens' a GenericCache #
Instances
| HasGenericCache GenericCache # | |
Defined in Data.GenericCache Methods | |
Lens functions
anyLens :: forall a s. (HasGenericCache s, Typeable a, HasCallStack) => a -> Lens' s a #
Generic lens, allows access to a single a inside a value s.
It has a default value argument.
> view (anyLens 'a') $ (anyLens 'a' %~ succ . succ) (mempty :: GenericCache)
c
Map lens functions
atLens :: forall k v s. (HasGenericCache s, Typeable k, Ord k, Typeable v, HasCallStack) => k -> Lens' s (Maybe v) #
An At lens to an element of a map.
mapLens :: forall k v s. (HasGenericCache s, Typeable k, Ord k, Typeable v, HasCallStack) => Lens' s (Map k v) #
Access the whole map that atLens provides element access to:
> view (mapLens @Char @String) $
atLens 'x' .~ Just "hello" $
atLens 'y' .~ Just "world" $
(mempty :: GenericCache)
fromList [('x',"hello"),('y',"world")]