WashNGo-2.12.0.1: WASH is a family of EDSLs for programming Web applications in Haskell.

WASH.CGI.Cookie

Description

creating, setting, reading, and deleting cookies. Cookies are type-indexed, i.e., there is a different cookie for each name and type.

Synopsis

Documentation

data T a Source

type of handles to a PE of type a

Instances

Read (T a) 
Show (T a) 

check :: (Read a, Show a, Types a) => String -> CGI (Maybe (T a))Source

check name returns the current handle to cookie name if that exists.

create :: (Read a, Show a, Types a) => String -> a -> CGI (T a)Source

create name initValue creates cookie name with initial value initValue and returns its current handle. The cookie expires at the end of the current run of the browser.

createExpiring :: (Read a, Show a, Types a) => String -> Int -> a -> CGI (T a)Source

like create with additional parameter specifying number of minutes until cookie expires.

init :: (Read a, Show a, Types a) => String -> a -> CGI (T a)Source

init name initValue returns current handle to cookie name. If the cookie did not exist before, it is created and set to initialValue. The cookie expires at the end of the current run of the browser.

initExpiring :: (Read a, Show a, Types a) => String -> Int -> a -> CGI (T a)Source

initExpiring name minutes initValue works like init except that the expiration time is minutes in the future.

get :: (Read a, Show a, Types a) => T a -> CGI (Maybe a)Source

get handle returns the cookie's value if the handle is current, otherwise returns Nothing

set :: (Read a, Show a, Types a) => T a -> a -> CGI (Maybe (T a))Source

set handle newValue overwrites the cookie's value with newValue if the handle is current. In that case it returns a handle which is current for newValue. Otherwise, the result is Nothing.

current :: (Read a, Show a, Types a) => T a -> CGI (Maybe (T a))Source

current handle returns Nothing if handle is still current. Otherwise, it returns Just newHandle where newHandle is current for the cookie pointed to by handle.

delete :: Types a => T a -> CGI ()Source

delete handle removes the cookie determined by handle.