Safe Haskell | None |
---|---|
Language | Haskell98 |
- type Session m k v = (k -> m (Maybe v), k -> v -> m ())
- type SessionStore m k v = Maybe ByteString -> IO (Session m k v, IO ByteString)
- withSession :: SessionStore m k v -> ByteString -> SetCookie -> Key (Session m k v) -> Middleware
- genSessionId :: IO ByteString
Documentation
type Session m k v = (k -> m (Maybe v), k -> v -> m ()) Source
Type representing a single session (a lookup, insert pair)
type SessionStore m k v = Maybe ByteString -> IO (Session m k v, IO ByteString) Source
A SessionStore
takes in the contents of the cookie (if there was one)
and returns a (Session
, IO
action to get new contents for cookie) pair
:: SessionStore m k v | The |
-> ByteString | Name to use for the session cookie (MUST BE ASCII) |
-> SetCookie | Settings for the cookie (path, expiry, etc) |
-> Key (Session m k v) |
|
-> Middleware |
Fully parameterised middleware for cookie-based sessions
genSessionId :: IO ByteString Source
Simple session ID generator based on time and Unique
Useful for session stores that use session IDs.