Lucu-1.0: Embedded HTTP Server

Network.HTTP.Lucu.Utils

Description

Utility functions used internally in this package.

Synopsis

Documentation

type Scheme = CIAsciiSource

Scheme represents an URI scheme.

type Host = CI TextSource

Host represents an IP address or a host name in an URI authority.

type PathSegment = ByteStringSource

PathSegment represents an URI path segment, split by slashes and percent-decoded.

type Path = [PathSegment]Source

Path is a list of URI path segments.

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

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

quoteStr :: Ascii -> AsciiBuilderSource

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

parseWWWFormURLEncoded :: Ascii -> [(ByteString, ByteString)]Source

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

uriCIScheme :: URI -> CIAsciiSource

>>> uriCIScheme "http://example.com/foo/bar"
 "http"

uriHost :: URI -> HostSource

>>> uriHost "http://example.com/foo/bar"
 "example.com"

uriPathSegments :: URI -> PathSource

>>> uriPathSegments "http://example.com/foo/bar"
 ["foo", "bar"]

trim :: String -> StringSource

>>> trim "  ab c d "
 "ab c d"

(⊲) :: Sequence α a => a -> α -> αSource

(⊲) = (<|)

U+22B2, NORMAL SUBGROUP OF

(⊳) :: Sequence α a => α -> a -> αSource

(⊳) = (|>)

U+22B3, CONTAINS AS NORMAL SUBGROUP

(⋈) :: Sequence α a => α -> α -> αSource

(⋈) = (><)

U+22C8, BOWTIE

mapM :: (Foldable α a, Unfoldable β b, Functor m, Monad m) => (a -> m b) -> α -> m βSource

Generalised mapM from any Foldable to Unfoldable. Why isn't this in the collections-api?

getLastModified :: FilePath -> IO UTCTimeSource

Get the modification time of a given file.