InternetLib

InternetLib Reference Manual

Created from the InternetLib sources on Sat May 24 21:13:23 MET DST 2003

Full Index

Sections


InternetLib

Fetching documents:
type HttpReq = HttpRequest URL
type HttpResp = Either String (URL, Either String HttpResponse)
htmlFetchF :: F String String
urlFetchF :: F HttpReq HttpResp
HTML:
type Html = [HtmlItem]
data HtmlItem = ...
type HtmlTag = (TagName, TagAttrs)
type HtmlBadTag = (String, TagAttrs)
type TagAttrs = [(String, String)]
data TagName = ...
allTags :: [TagName]
blockTagRange :: (TagName, TagName)
parseHtml :: String -> Either ([String], String) Html
printHtml :: Html -> String
printTag :: HtmlTag -> String
HTML construction:
cmd :: TagName -> HtmlItem
cmd' :: TagName -> TagAttrs -> HtmlItem
ctx :: TagName -> Html -> HtmlItem
ctx' :: TagName -> TagAttrs -> Html -> HtmlItem
ctx_class :: TagName -> String -> Html -> HtmlItem
nl :: HtmlItem
txt :: String -> HtmlItem
HTML construction convenience:
body :: [HtmlItem] -> HtmlItem
body' :: TagAttrs -> [HtmlItem] -> HtmlItem
br :: HtmlItem
dd :: Html -> HtmlItem
dir :: [Html] -> HtmlItem
div_class :: String -> Html -> HtmlItem
dl :: Html -> HtmlItem
dt :: Html -> HtmlItem
em :: Html -> HtmlItem
form :: Html -> HtmlItem
form' :: TagAttrs -> Html -> HtmlItem
h1 :: Html -> HtmlItem
h2 :: Html -> HtmlItem
h3 :: Html -> HtmlItem
h4 :: Html -> HtmlItem
h5 :: Html -> HtmlItem
h6 :: Html -> HtmlItem
head' :: [HtmlItem] -> HtmlItem
hr :: HtmlItem
href :: String -> Html -> HtmlItem
html :: [HtmlItem] -> HtmlItem
img :: String -> HtmlItem
imgalt :: String -> String -> HtmlItem
input :: String -> [(String, String)] -> HtmlItem
li :: Html -> HtmlItem
menu :: [Html] -> HtmlItem
ol :: Html -> HtmlItem
p :: Html -> HtmlItem
pre :: Html -> HtmlItem
reset :: String -> HtmlItem
span_class :: String -> Html -> HtmlItem
strong :: Html -> HtmlItem
submit :: String -> HtmlItem
target :: String -> Html -> HtmlItem
td :: Html -> HtmlItem
title :: Html -> HtmlItem
tr :: Html -> HtmlItem
ul :: Html -> HtmlItem
HTML document analysis:
extractBase :: [HtmlItem] -> Maybe String
extractBodyAttrs :: [HtmlItem] -> [(String, String)]
extractElements :: TagName -> [HtmlItem] -> [HtmlItem]
extractElements' :: (HtmlTag -> Bool) -> [HtmlItem] -> [HtmlItem]
extractTitle :: [HtmlItem] -> Maybe [Char]
htmlchars :: [HtmlItem] -> [Char]
HTML document manipulation:
mapHtmlChars :: (String -> [HtmlItem]) -> [HtmlItem] -> [HtmlItem]
mapHtmlTags :: (HtmlTag -> HtmlTag) -> [HtmlItem] -> [HtmlItem]
rmHtmlGarbage :: [HtmlItem] -> [HtmlItem]
HTTP Servers:
type SimpleHttpRequest = (Host, CalendarTime, HttpRequest String)
data SimpleHttpResponse
replyWith :: HttpResponse -> SimpleHttpResponse
replyWithFile :: FilePath -> SimpleHttpResponse
saveThen :: (FilePath, String) -> SimpleHttpResponse -> SimpleHttpResponse
simpleHttpServer :: (a -> SimpleHttpRequest -> (a, SimpleHttpResponse)) -> a -> Port -> IO ()
HTTP related types:
data HttpRequest a = ...
data HttpMethod = ...
type HttpHeaders = Headers
data HttpResponse = ...
type Headers = [(String, String)]
badQueryResponse :: String -> HttpResponse
badQueryResponse' :: HttpHeaders -> String -> HttpResponse
contentType :: String -> HttpHeaders
getQuery :: HttpRequest String -> Maybe (FilePath, [(String, String)])
getSimpleQuery :: HttpRequest String -> Maybe (FilePath, String)
htmlType :: HttpHeaders
notFoundResponse :: [Char] -> HttpResponse
notFoundResponse' :: HttpHeaders -> String -> HttpResponse
notImplementedResponse :: String -> HttpResponse
notImplementedResponse' :: HttpHeaders -> String -> HttpResponse
okResponse :: String -> HttpResponse
okResponse' :: HttpHeaders -> String -> HttpResponse
reqHdrs :: HttpRequest a -> HttpHeaders
reqMethod :: HttpRequest a -> HttpMethod
reqURI :: HttpRequest a -> a
respBody :: HttpResponse -> String
respCode :: HttpResponse -> Int
respHdrs :: HttpResponse -> HttpHeaders
respMsg :: HttpResponse -> String
stdResponse :: Int -> String -> HttpHeaders -> String -> HttpResponse
Images:
data GIFFile
data PNMFile
gifFile :: FilePath -> GIFFile
pnmFile :: FilePath -> PNMFile
URL:
data URL = ...
type Proto = String
type Host = String
type Port = Int
type Fragment = String
parseURL :: [Char] -> Maybe URL
url2str :: URL -> [Char]
URL functions:
decode :: [Char] -> [Char]
decodeQuery :: [Char] -> [([Char], [Char])]
docURL :: URL -> URL
encode :: [Char] -> [Char]
encodeQuery :: [([Char], [Char])] -> [Char]
fragment :: URL -> Maybe Fragment
fragmentURL :: Fragment -> URL
joinURL :: URL -> URL -> URL
relativeURL :: FilePath -> URL
sameDoc :: URL -> URL -> Bool
urlHost :: URL -> Maybe Host
urlPath :: URL -> FilePath
Miscellaneous (the rest):
data CalendarTime
ctxie :: TagName -> Html -> HtmlItem
ctxie' :: TagName -> [(String, String)] -> Html -> HtmlItem
dlcompact :: Html -> HtmlItem
getHtml :: String -> HttpReq
li' :: HtmlItem
p' :: HtmlItem
parseHtmlText :: String -> Either ([String], String) Html
showHttpRequest :: (a -> String) -> HttpRequest a -> [Char]
showHttpResponse :: HttpResponse -> [Char]
showHttpResponse' :: (String -> [Char]) -> HttpResponse -> [Char]