frame-0.1: A simple web framework.

Frame.Session

Contents

Description

Defines functions for state that can persist accross server requests

Synopsis

Session management

startSession :: FrameRouter m => m FieldsSource

Recovers a session from persistent storage

saveSession :: FrameRouter m => m ()Source

Saves a session to persistent storage

deleteSession :: FrameRouter m => m ()Source

Deletes a session from persistent storage

withSessionSource

Arguments

:: FrameRouter m 
=> ([String] -> m a)

A router to run

-> [String] -> m a

A router wrapped with a session

A convenience function when running a router, starting and saving a function before and after the router is run

genSessionId :: IO StringSource

Generate a unique session ID

Session manipulation

getSessionFieldSource

Arguments

:: FrameReader m 
=> FieldName

The FieldName to get from the session

-> m (Maybe WrapperType)

The session field (if found)

Get a field from the session by FieldName

delSessionFieldSource

Arguments

:: FrameState m 
=> FieldName

FieldName to be deleted

-> m () 

Deletes a specific field in the session by the given field name

copyToSessionSource

Arguments

:: FrameState m 
=> FieldName

The FieldName to be copied to the session

-> m ()

Nothing (but the modified state) is returned

Copy a particular field to the session from the fields in the state

copyFromSessionSource

Arguments

:: (FrameState m, FrameConfig m) 
=> FieldName

The FieldName to be copied from the session

-> m ()

Nothing (but the modified state) is returned

Copy a particular field to the session from the fields in the state

updateFlashSource

Arguments

:: FrameState m 
=> String

Message to flash to the screen

-> m ()

Nothing (but the modified state) is returned

Overwrite a message to be flashed to the screen (persisting across requests)

flashSource

Arguments

:: FrameRouter m 
=> m Data

The router to have the message flashed to

-> m Data 

Given a router, flashes the current message to screen before deleting it