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 appears to me as though the internal structure of the Session type is not used in Network.Wai.Session, and thus it could be generalized to support other kinds of sessions.
Specifically it seems as though:
type SessionStore m k v = (Maybe ByteString -> IO (Session m k v, IO ByteString))
type Session m k v = ((k -> m (Maybe v)), (k -> v -> m ()))
Could be replaced with
type SessionStore s = (Maybe ByteString -> IO (Maybe s, IO ByteString))
Then Network.Wai.Session.Map could be adjusted to:
type Session m k v = ((k -> m (Maybe v)), (k -> v -> m ()))
mapStore_ :: (Ord k, MonadIO m) => IO (SessionStore (Session m k v))
The practical reason why I ask for this, is because in my case sessions are simply represented by a UserId and all stateful changes to the session are done via the DB. So the Map-based representation is very awkward.
The reason for Maybe s instead of s, is that due to the nature of Vault, you must always handle the case where nothing was inserted into the key. So you may as well allow wai-session to make use of this, to avoid having to doubly nest Maybe in the case that you want to be able to support a Nothing session.
The text was updated successfully, but these errors were encountered:
It appears to me as though the internal structure of the
Session
type is not used inNetwork.Wai.Session
, and thus it could be generalized to support other kinds of sessions.Specifically it seems as though:
Could be replaced with
Then
Network.Wai.Session.Map
could be adjusted to:The practical reason why I ask for this, is because in my case sessions are simply represented by a
UserId
and all stateful changes to the session are done via the DB. So the Map-based representation is very awkward.The reason for
Maybe s
instead ofs
, is that due to the nature ofVault
, you must always handle the case where nothing was inserted into the key. So you may as well allowwai-session
to make use of this, to avoid having to doubly nestMaybe
in the case that you want to be able to support aNothing
session.The text was updated successfully, but these errors were encountered: