You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's somewhat unfortunate you can't create the cached value inside the STM monad.
I have a situation where I need to inspect some TVars first before deciding whether to create a new Cached value, and the golden path is that it doesn't have to be created, so in general I will be creating unnecessary Cached values to then ignore them.
With the following tweak, it would be an easy addition, I feel.
-- >> New base for all other functions instead of 'cachedIOWith''
cachedIOWithSTM'
:: (MonadIOt, MonadCatcht)
=> (UTCTime->UTCTime->Bool)
-> (Maybe (UTCTime, a) ->ta)
->STM (Cachedta)
cachedIOWithSTM' isCacheStillFresh io =do
cachedT <- newTVar Uninitializedpure.Cached$do...-- >> Defined in terms of 'cachedIOWithSTM''
cachedIOWith' isCacheStillFresh io =
liftIO . atomically $ cachedIOWithSTM' isCachedStillFresh io
The text was updated successfully, but these errors were encountered:
It's somewhat unfortunate you can't create the cached value inside the STM monad.
I have a situation where I need to inspect some TVars first before deciding whether to create a new
Cached
value, and the golden path is that it doesn't have to be created, so in general I will be creating unnecessaryCached
values to then ignore them.With the following tweak, it would be an easy addition, I feel.
The text was updated successfully, but these errors were encountered: