WashNGo-2.12: WASH is a family of embedded domain specific languages (EDSL) for programming Web applications in Haskell.ContentsIndex
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
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
data T a
type of handles to a PE of type a
show/hide Instances
Read (T a)
Show (T a)
check :: (Read a, Show a, Types a) => String -> CGI (Maybe (T a))
check name returns the current handle to cookie name if that exists.
create :: (Read a, Show a, Types a) => String -> a -> CGI (T a)
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)
like create with additional parameter specifying number of minutes until cookie expires.
init :: (Read a, Show a, Types a) => String -> a -> CGI (T a)
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)
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)
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))
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))
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 ()
delete handle removes the cookie determined by handle.
Produced by Haddock version 0.8