Lucu-0.7.0.1: HTTP Daemonic Library

Network.HTTP.Lucu.Utils

Description

Utility functions used internally in the Lucu httpd. These functions may be useful too for something else.

Synopsis

Documentation

splitBy :: (a -> Bool) -> [a] -> [[a]]Source

 splitBy (== ':') "ab:c:def"
 ==> ["ab", "c", "def"]

joinWith :: [a] -> [[a]] -> [a]Source

 joinWith ":" ["ab", "c", "def"]
 ==> "ab:c:def"

trim :: (a -> Bool) -> [a] -> [a]Source

 trim (== '_') "__ab_c__def___"
 ==> "ab_c__def"

isWhiteSpace :: Char -> BoolSource

isWhiteSpace c is True iff c is one of SP, HT, CR and LF.

quoteStr :: String -> StringSource

 quoteStr "abc"
 ==> "\"abc\""
 quoteStr "ab\"c"
 ==> "\"ab\\\"c\""

parseWWWFormURLEncoded :: String -> [(String, String)]Source

 parseWWWFormURLEncoded "aaa=bbb&ccc=ddd"
 ==> [("aaa", "bbb"), ("ccc", "ddd")]