summaryrefslogtreecommitdiff
path: root/src/Storage.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-09-19 20:49:58 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2023-10-19 21:37:01 +0200
commit61808c8cd7b30ceaf9915e72d734c4d095ff67d6 (patch)
tree7897848d5e61747c5ccf4136bc77c9d9490d1c52 /src/Storage.hs
parent967cb4587c1af9fb53bfd1a30d007877d16e03fa (diff)
Identity extension data
Diffstat (limited to 'src/Storage.hs')
-rw-r--r--src/Storage.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Storage.hs b/src/Storage.hs
index 69e8ab6..7edae8b 100644
--- a/src/Storage.hs
+++ b/src/Storage.hs
@@ -46,6 +46,7 @@ module Storage (
fromStored, storedRef,
wrappedStore, wrappedLoad,
copyStored,
+ unsafeMapStored,
StoreInfo(..), makeStoreInfo,
@@ -891,6 +892,10 @@ copyStored :: forall c c' m a. (StorageCompleteness c, StorageCompleteness c', M
Storage' c' -> Stored' c a -> m (LoadResult c (Stored' c' a))
copyStored st (Stored ref' x) = liftIO $ returnLoadResult . fmap (flip Stored x) <$> copyRef' st ref'
+-- |Passed function needs to preserve the object representation to be safe
+unsafeMapStored :: (a -> b) -> Stored a -> Stored b
+unsafeMapStored f (Stored ref x) = Stored ref (f x)
+
data StoreInfo = StoreInfo
{ infoDate :: ZonedTime