]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Network/HTTP/Lucu/MIMEType.hs
</> is better than +/+
[Lucu.git] / Network / HTTP / Lucu / MIMEType.hs
index bd799e0d58f840dc9cb700be51e33e19e6496057..93b8f1ff38d7aeed4f388432ee5cc8463bb68166 100644 (file)
@@ -1,10 +1,13 @@
+-- #prune
+
+-- |Manipulation of MIME Types.
 module Network.HTTP.Lucu.MIMEType
     ( MIMEType(..)
-    , (+/+)         -- String -> String -> MIMEType
-    , (+:+)         -- MIMEType -> (String, String) -> MIMEType
-    , (+=+)         -- String -> String -> (String, String)
-    , mimeTypeP     -- Parser MIMEType
-    , mimeTypeListP -- Parser [MIMEType]
+    , (</>)
+    , (<:>)
+    , (<=>)
+    , mimeTypeP
+    , mimeTypeListP
     )
     where
 
@@ -12,7 +15,8 @@ import           Network.HTTP.Lucu.Parser
 import           Network.HTTP.Lucu.Parser.Http
 import           Network.HTTP.Lucu.Utils
 
-
+-- |@'MIMEType' \"major\" \"minor\" [(\"name\", \"value\")]@
+-- represents \"major\/minor; name=value\".
 data MIMEType = MIMEType {
       mtMajor  :: String
     , mtMinor  :: String
@@ -36,25 +40,28 @@ instance Show MIMEType where
                                    value
 
 
-infix  9 +/+, +=+
-infixl 8 +:+
-
+infix  9 </>, <=>
+infixl 8 <:>
 
-(+/+) :: String -> String -> MIMEType
-maj +/+ min
+-- |@\"major\" \<\/\> \"minor\"@ constructs a MIME Type
+-- \"major\/minor\".
+(</>) :: String -> String -> MIMEType
+maj </> min
     = MIMEType maj min []
 
-
-(+:+) :: MIMEType -> (String, String) -> MIMEType
-mt@(MIMEType _ _ params) +:+ pair
+-- |\<\:\> appends a @(name, value)@ pair to a MIME Type.
+(<:>) :: MIMEType -> (String, String) -> MIMEType
+mt@(MIMEType _ _ params) <:> pair
     = mt {
         mtParams = mtParams mt ++ [pair]
       }
 
-
-(+=+) :: String -> String -> (String, String)
-name +=+ value = (name, value)
-
+-- |\<\=\> takes two strings and makes a tuple of them. So you can say
+-- @\"text\" \<\/\> \"xml\" \<\:\> \"charset\" \<\=\> \"UTF-8\" \<\:\>
+-- \"q\" \<\=\> \"0.9\"@ to represent \"text\/xml; charset=UTF-8;
+-- q=0.9\".
+(<=>) :: String -> String -> (String, String)
+name <=> value = (name, value)
 
 
 mimeTypeP :: Parser MIMEType