Network.HTTP.Lucu.Utils
Description
Utility functions used internally in this package.
- type Scheme = CIAscii
- type Host = CI Text
- type PathSegment = ByteString
- type Path = [PathSegment]
- splitBy :: (a -> Bool) -> [a] -> [[a]]
- quoteStr :: Ascii -> AsciiBuilder
- parseWWWFormURLEncoded :: Ascii -> [(ByteString, ByteString)]
- uriCIScheme :: URI -> CIAscii
- uriHost :: URI -> Host
- uriPathSegments :: URI -> Path
- trim :: String -> String
- (⊲) :: Sequence α a => a -> α -> α
- (⊳) :: Sequence α a => α -> a -> α
- (⋈) :: Sequence α a => α -> α -> α
- mapM :: (Foldable α a, Unfoldable β b, Functor m, Monad m) => (a -> m b) -> α -> m β
- getLastModified :: FilePath -> IO UTCTime
Documentation
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.
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"
uriPathSegments :: URI -> PathSource
>>>uriPathSegments "http://example.com/foo/bar"["foo", "bar"]
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.