mysnapsession-0.4.1: Sessions and continuations for Snap web apps

Snap.Extension.Session

Description

Snap.Extension.Session exports the MonadSession type class, which allows you to keep a session object for each client session of a web application. Convenience functions are provided for those cases where the session type is a Map.

Synopsis

Documentation

class MonadSnap m => MonadSession m whereSource

This type class captures all Snap-related monads that contain a session.

Associated Types

type Session m Source

The type of the session object. In principle, this may be any type that you want. However, implementations or other extensions maybe put additional restrictions on the type (for example, the session implementation in Snap.Extension.Session.Client requires that the session type be an instance of Data.Serialize.Serialize.

inSession :: MonadSession m => m a -> m aSource

Insert this into your routes to renew sessions on each request.

withSession :: MonadSession m => (Session m -> m a) -> m aSource

getFromSession :: (Ord k, MonadSession m, Session m ~ Map k a) => k -> m (Maybe a)Source

deleteFromSession :: (Ord k, MonadSession m, Session m ~ Map k a) => k -> m ()Source

setInSession :: (Ord k, MonadSession m, Session m ~ Map k a) => k -> a -> m ()Source