yesod-session-persist-0.0.0.2: SQL session backend for Yesod
Safe HaskellSafe-Inferred
LanguageGHC2021

Yesod.Session.Embedding.Map

Synopsis

Documentation

type SessionMapEmbedding a = Embedding (MapOperations Text ByteString) () a Source #

Specifies how we represent some value within a SessionMap

We use this to sort of abuse the session; key rotation and freezing are done by embedding special values among the session data. These special values are extracted from the map before persisting to storage and are never actually saved.

class (Monad m, Ord k) => MapOperations k v m | m -> k v where Source #

A monadic context with operations over some Map-like state

This allows us to generalize between pure operations over Map and the more limited session manipulation utilities afforded by Yesod. (See the instance list for this class.)

Methods

lookup :: k -> m (Maybe v) Source #

assign :: k -> Maybe v -> m () Source #

Instances

Instances details
MapOperations Text ByteString (HandlerFor site) Source # 
Instance details

Defined in Yesod.Session.Embedding.Map

(Monad m, Ord k) => MapOperations k v (StateT (Map k v) m) Source # 
Instance details

Defined in Yesod.Session.Embedding.Map

Methods

lookup :: k -> StateT (Map k v) m (Maybe v) Source #

assign :: k -> Maybe v -> StateT (Map k v) m () Source #

bsKeyEmbedding :: k -> Embedding (MapOperations k a) e a Source #

An embedding which stores a value at some particular key in a map-like structure

showReadKeyEmbedding :: (Read a, Show a) => k -> Embedding (MapOperations k ByteString) () a Source #

Represents a value in a SessionMap by storing the UTF-8 encoding of its show representation at the given key