-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | client-side session data -- -- uses the clientsession library to store session data in an HTTP cookie @package happstack-clientsession @version 7.0.0 module Happstack.Server.ClientSession -- | Your session type must have an instance for this class. class SafeCopy st => ClientSession st empty :: ClientSession st => st -- | Configuration for the session cookie for passing to -- runClientSessionT. data SessionConf SessionConf :: String -> CookieLife -> Key -> Bool -> SessionConf -- | Name of the cookie to hold your session data. sessionCookieName :: SessionConf -> String -- | Lifetime of that cookie. sessionCookieLife :: SessionConf -> CookieLife -- | Encryption key, usually from getKey or -- getDefaultKey. sessionKey :: SessionConf -> Key -- | Only use a session over secure transports. sessionSecure :: SessionConf -> Bool -- | Create a SessionConf using defaults for everything except -- sessionKey. You can use record update syntax to override -- individual fields. -- --
-- main = do key <- getDefaultKey
-- let sessConf = (mkSessionConf key) { sessionCookieLife = oneWeek }
-- simpleHTTP nullConf $ runClientSessionT handlers sessConf
-- where
-- oneWeek = MaxAge $ 60 * 60 * 24 * 7
-- handlers = sessionPart $ msum [...]
--
mkSessionConf :: Key -> SessionConf
-- | Transformer for monads capable of using a session.
data ClientSessionT st m a
-- | Get the inner monad of a ClientSessionT.
runClientSessionT :: Monad m => ClientSessionT st m a -> SessionConf -> m a
-- | Get the session value. If the cookie has not been decoded yet, it will
-- be decoded. If no session data is stored or the session has been
-- expired, empty is returned.
getSession :: (Functor m, MonadPlus m, HasRqData m, ClientSession st) => ClientSessionT st m st
-- | Put a new value in the session.
putSession :: (Monad m, ClientSession st) => st -> ClientSessionT st m ()
-- | Expire the session, i.e. the cookie holding it.
expireSession :: Monad m => ClientSessionT st m ()
-- | Run a State monad with the session.
withSession :: (Functor m, MonadPlus m, HasRqData m, ClientSession st, Eq st) => State st a -> ClientSessionT st m a
-- | Wrapper around your handlers that use the session. Takes care of
-- expiring the cookie of an expired session, or encrypting a modified
-- session into the cookie.
sessionPart :: (Functor m, Monad m, MonadIO m, FilterMonad Response m, ClientSession st) => ClientSessionT st m a -> ClientSessionT st m a
instance Functor m => Functor (ClientSessionT st m)
instance (Monad m, Functor m) => Applicative (ClientSessionT st m)
instance (Functor m, MonadPlus m) => Alternative (ClientSessionT st m)
instance Monad m => Monad (ClientSessionT st m)
instance MonadIO m => MonadIO (ClientSessionT st m)
instance MonadPlus m => MonadPlus (ClientSessionT st m)
instance (Monad m, HasRqData m) => HasRqData (ClientSessionT st m)
instance FilterMonad r m => FilterMonad r (ClientSessionT st m)
instance WebMonad r m => WebMonad r (ClientSessionT st m)
instance ServerMonad m => ServerMonad (ClientSessionT st m)
instance Happstack m => Happstack (ClientSessionT st m)