]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/Utils.hs
Scrap SchemeMapper
[Lucu.git] / Network / HTTP / Lucu / Utils.hs
index d36c81b2853cb7e01adf861bed59e344b4181f7c..7623c70e45d7d604beb019aa20f09bfe57987a28 100644 (file)
@@ -5,15 +5,13 @@
   #-}
 -- |Utility functions used internally in this package.
 module Network.HTTP.Lucu.Utils
-    ( Scheme
-    , Host
+    ( Host
     , PathSegment
-    , PathSegments
+    , Path
 
     , splitBy
     , quoteStr
     , parseWWWFormURLEncoded
-    , uriCIScheme
     , uriHost
     , uriPathSegments
     , trim
@@ -28,7 +26,7 @@ module Network.HTTP.Lucu.Utils
     where
 import Control.Applicative hiding (empty)
 import Control.Monad hiding (mapM)
-import Data.Ascii (Ascii, AsciiBuilder, CIAscii)
+import Data.Ascii (Ascii, AsciiBuilder)
 import qualified Data.Ascii as A
 import Data.ByteString (ByteString)
 import qualified Data.ByteString.Char8 as BS
@@ -50,9 +48,6 @@ import Prelude.Unicode
 import System.Directory
 import System.Time (ClockTime(..))
 
--- |'Scheme' represents an URI scheme.
-type Scheme = CIAscii
-
 -- |'Host' represents an IP address or a host name in an URI
 -- authority.
 type Host = CI Text
@@ -61,8 +56,8 @@ type Host = CI Text
 -- percent-decoded.
 type PathSegment = ByteString
 
--- |'PathSegments' is a list of URI path segments.
-type PathSegments = [PathSegment]
+-- |'Path' is a list of URI path segments.
+type Path = [PathSegment]
 
 -- |>>> splitBy (== ':') "ab:c:def"
 -- ["ab", "c", "def"]
@@ -118,12 +113,6 @@ parseWWWFormURLEncoded src
       plusToSpace '+' = ' '
       plusToSpace c   = c
 
--- |>>> uriCIScheme "http://example.com/foo/bar"
--- "http"
-uriCIScheme ∷ URI → Scheme
-{-# INLINE uriCIScheme #-}
-uriCIScheme = A.toCIAscii ∘ A.unsafeFromString ∘ uriScheme
-
 -- |>>> uriHost "http://example.com/foo/bar"
 -- "example.com"
 uriHost ∷ URI → Host
@@ -132,7 +121,7 @@ uriHost = CI.mk ∘ T.pack ∘ uriRegName ∘ fromJust ∘ uriAuthority
 
 -- |>>> uriPathSegments "http://example.com/foo/bar"
 -- ["foo", "bar"]
-uriPathSegments ∷ URI → PathSegments
+uriPathSegments ∷ URI → Path
 uriPathSegments uri
     = let reqPathStr = uriPath uri
           reqPath    = [ unEscapeString x