creating, setting, reading, and deleting cookies. Cookies are type-indexed, i.e., there is a different cookie for each name and type.
- data T a
- check :: (Read a, Show a, Types a) => String -> CGI (Maybe (T a))
- create :: (Read a, Show a, Types a) => String -> a -> CGI (T a)
- createExpiring :: (Read a, Show a, Types a) => String -> Int -> a -> CGI (T a)
- init :: (Read a, Show a, Types a) => String -> a -> CGI (T a)
- initExpiring :: (Read a, Show a, Types a) => String -> Int -> a -> CGI (T a)
- get :: (Read a, Show a, Types a) => T a -> CGI (Maybe a)
- set :: (Read a, Show a, Types a) => T a -> a -> CGI (Maybe (T a))
- current :: (Read a, Show a, Types a) => T a -> CGI (Maybe (T a))
- delete :: Types a => T a -> CGI ()
Documentation
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
.