]> gitweb @ CieloNegro.org - Lucu.git/commitdiff
</> is better than +/+
authorpho <pho@cielonegro.org>
Fri, 20 Apr 2007 14:51:25 +0000 (23:51 +0900)
committerpho <pho@cielonegro.org>
Fri, 20 Apr 2007 14:51:25 +0000 (23:51 +0900)
darcs-hash:20070420145125-62b54-23b1d7f9a2def6491adff61696ca9c7ebfa49667.gz

Network/HTTP/Lucu.hs
Network/HTTP/Lucu/ETag.hs
Network/HTTP/Lucu/HttpVersion.hs
Network/HTTP/Lucu/MIMEType.hs
Network/HTTP/Lucu/MIMEType/DefaultExtensionMap.hs
Network/HTTP/Lucu/MIMEType/Guess.hs
Network/HTTP/Lucu/Resource/Tree.hs
Network/HTTP/Lucu/Response.hs
examples/HelloWorld.hs

index b2c88c6a0255f4417aa0e7f6228708ab4971293a..6f6e4d92f546f4e8b8e14d5280cdd174a80d9011 100644 (file)
@@ -16,14 +16,10 @@ module Network.HTTP.Lucu
 
       -- MIMEType
     , MIMEType(..)
-    , (+/+)
-    , (+:+)
-    , (+=+)
+    , (</>)
+    , (<:>)
+    , (<=>)
     
-      -- Request
-    , Method(..)
-    , Request(..)
-
       -- Resource (driftTo だけは要らない)
     , module Network.HTTP.Lucu.Resource
 
index 856588364b7c1a73daa4c2d46c280feefa18bbf0..bdb1473786a001fa016f9e4b8440892c5220060f 100644 (file)
@@ -1,6 +1,6 @@
 -- #prune
 
--- |Creation and comparison of entity tags.
+-- |Manipulation of entity tags.
 module Network.HTTP.Lucu.ETag
     ( ETag(..)
     , strongETag
index 9b955d37fd9644beb912feb1808a1f2982dd97b9..38d0e5b81ad49767621098c06bb499f347bae175 100644 (file)
@@ -1,7 +1,10 @@
+-- #prune
+
+-- |Manipulation of HTTP version string.
 module Network.HTTP.Lucu.HttpVersion
     ( HttpVersion(..)
-    , httpVersionP    -- Parser HttpVersion
-    , hPutHttpVersion -- Handle -> HttpVersion -> IO ()
+    , httpVersionP
+    , hPutHttpVersion
     )
     where
 
@@ -10,6 +13,7 @@ import           Data.ByteString.Lazy.Char8 (ByteString)
 import           Network.HTTP.Lucu.Parser
 import           System.IO
 
+-- |@'HttpVersion' major minor@ represents \"HTTP\/major.minor\".
 data HttpVersion = HttpVersion Int Int
                    deriving (Eq)
 
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
index 642afb2c58f5462fbb4418dd4eea74bd657bd082..cdeb0e84e82c4421317c04f8b598f143beda8806 100644 (file)
@@ -11,179 +11,179 @@ import Data.Map (Map)
 defaultExtensionMap :: Map String MIMEType
 defaultExtensionMap
   = M.fromList
-      [("3gp", "application" +/+ "x-3gp"), ("669", "audio" +/+ "x-mod"),
-       ("Z", "application" +/+ "x-compress"),
-       ("a", "application" +/+ "x-ar"), ("ac3", "audio" +/+ "x-ac3"),
-       ("ai", "application" +/+ "postscript"),
-       ("aif", "audio" +/+ "x-aiff"), ("aifc", "audio" +/+ "x-aiff"),
-       ("aiff", "audio" +/+ "x-aiff"), ("amf", "audio" +/+ "x-mod"),
-       ("anx", "application" +/+ "ogg"),
-       ("ape", "application" +/+ "x-ape"), ("asc", "text" +/+ "plain"),
-       ("asf", "video" +/+ "x-ms-asf"),
-       ("atom", "application" +/+ "atom+xml"), ("au", "audio" +/+ "x-au"),
-       ("avi", "video" +/+ "x-msvideo"),
-       ("bcpio", "application" +/+ "x-bcpio"),
-       ("bin", "application" +/+ "octet-stream"),
-       ("bmp", "image" +/+ "bmp"), ("bz2", "application" +/+ "x-bzip"),
-       ("cabal", "text" +/+ "x-cabal"),
-       ("cdf", "application" +/+ "x-netcdf"), ("cgm", "image" +/+ "cgm"),
-       ("class", "application" +/+ "octet-stream"),
-       ("cpio", "application" +/+ "x-cpio"),
-       ("cpt", "application" +/+ "mac-compactpro"),
-       ("csh", "application" +/+ "x-csh"), ("css", "text" +/+ "css"),
-       ("dcr", "application" +/+ "x-director"),
-       ("dif", "video" +/+ "x-dv"),
-       ("dir", "application" +/+ "x-director"),
-       ("djv", "image" +/+ "vnd.djvu"), ("djvu", "image" +/+ "vnd.djvu"),
-       ("dll", "application" +/+ "octet-stream"),
-       ("dmg", "application" +/+ "octet-stream"),
-       ("dms", "application" +/+ "octet-stream"),
-       ("doc", "application" +/+ "msword"), ("dsm", "audio" +/+ "x-mod"),
-       ("dtd", "application" +/+ "xml-dtd"), ("dv", "video" +/+ "x-dv"),
-       ("dvi", "application" +/+ "x-dvi"),
-       ("dxr", "application" +/+ "x-director"),
-       ("eps", "application" +/+ "postscript"),
-       ("etx", "text" +/+ "x-setext"),
-       ("exe", "application" +/+ "octet-stream"),
-       ("ez", "application" +/+ "andrew-inset"),
-       ("far", "audio" +/+ "x-mod"), ("flac", "audio" +/+ "x-flac"),
-       ("flc", "video" +/+ "x-fli"), ("fli", "video" +/+ "x-fli"),
-       ("flv", "video" +/+ "x-flv"), ("gdm", "audio" +/+ "x-mod"),
-       ("gif", "image" +/+ "gif"), ("gram", "application" +/+ "srgs"),
-       ("grxml", "application" +/+ "srgs+xml"),
-       ("gtar", "application" +/+ "x-gtar"),
-       ("gz", "application" +/+ "x-gzip"),
-       ("hdf", "application" +/+ "x-hdf"),
-       ("hi", "application" +/+ "octet-stream"),
-       ("hqx", "application" +/+ "mac-binhex40"),
-       ("hs", "text" +/+ "x-haskell"), ("htm", "text" +/+ "html"),
-       ("html", "text" +/+ "html"),
-       ("ice", "x-conference" +/+ "x-cooltalk"),
-       ("ico", "image" +/+ "x-icon"), ("ics", "text" +/+ "calendar"),
-       ("ief", "image" +/+ "ief"), ("ifb", "text" +/+ "calendar"),
-       ("iff", "audio" +/+ "x-svx"), ("iges", "model" +/+ "iges"),
-       ("igs", "model" +/+ "iges"), ("ilbc", "audio" +/+ "iLBC-sh"),
-       ("imf", "audio" +/+ "x-mod"), ("it", "audio" +/+ "x-mod"),
-       ("jng", "image" +/+ "x-jng"),
-       ("jnlp", "application" +/+ "x-java-jnlp-file"),
-       ("jp2", "image" +/+ "jp2"), ("jpe", "image" +/+ "jpeg"),
-       ("jpeg", "image" +/+ "jpeg"), ("jpg", "image" +/+ "jpeg"),
-       ("js", "application" +/+ "x-javascript"),
-       ("kar", "audio" +/+ "midi"),
-       ("latex", "application" +/+ "x-latex"),
-       ("lha", "application" +/+ "octet-stream"),
-       ("lzh", "application" +/+ "octet-stream"),
-       ("m3u", "audio" +/+ "x-mpegurl"), ("m4a", "audio" +/+ "mp4a-latm"),
-       ("m4p", "audio" +/+ "mp4a-latm"),
-       ("m4u", "video" +/+ "vnd.mpegurl"), ("m4v", "video" +/+ "mpeg4"),
-       ("mac", "image" +/+ "x-macpaint"),
-       ("man", "application" +/+ "x-troff-man"),
-       ("mathml", "application" +/+ "mathml+xml"),
-       ("me", "application" +/+ "x-troff-me"),
-       ("med", "audio" +/+ "x-mod"), ("mesh", "model" +/+ "mesh"),
-       ("mid", "audio" +/+ "midi"), ("midi", "audio" +/+ "midi"),
-       ("mif", "application" +/+ "vnd.mif"),
-       ("mka", "video" +/+ "x-matroska"),
-       ("mkv", "video" +/+ "x-matroska"), ("mng", "video" +/+ "x-mng"),
-       ("mod", "audio" +/+ "x-mod"), ("mov", "video" +/+ "quicktime"),
-       ("movie", "video" +/+ "x-sgi-movie"), ("mp2", "audio" +/+ "mpeg"),
-       ("mp3", "audio" +/+ "mpeg"), ("mp4", "video" +/+ "mp4"),
-       ("mpc", "audio" +/+ "x-musepack"), ("mpe", "video" +/+ "mpeg"),
-       ("mpeg", "video" +/+ "mpeg"), ("mpg", "video" +/+ "mpeg"),
-       ("mpga", "audio" +/+ "mpeg"),
-       ("ms", "application" +/+ "x-troff-ms"),
-       ("msh", "model" +/+ "mesh"), ("mtm", "audio" +/+ "x-mod"),
-       ("mve", "video" +/+ "x-mve"), ("mxu", "video" +/+ "vnd.mpegurl"),
-       ("nar", "application" +/+ "x-nar"),
-       ("nc", "application" +/+ "x-netcdf"),
-       ("nist", "audio" +/+ "x-nist"), ("nuv", "video" +/+ "x-nuv"),
-       ("o", "application" +/+ "octet-stream"),
-       ("oda", "application" +/+ "oda"), ("ogg", "application" +/+ "ogg"),
-       ("ogm", "application" +/+ "ogg"), ("okt", "audio" +/+ "x-mod"),
-       ("paf", "audio" +/+ "x-paris"),
-       ("pbm", "image" +/+ "x-portable-bitmap"),
-       ("pct", "image" +/+ "pict"), ("pdb", "chemical" +/+ "x-pdb"),
-       ("pdf", "application" +/+ "pdf"),
-       ("pgm", "image" +/+ "x-portable-graymap"),
-       ("pgn", "application" +/+ "x-chess-pgn"),
-       ("pic", "image" +/+ "pict"), ("pict", "image" +/+ "pict"),
-       ("png", "image" +/+ "png"),
-       ("pnm", "image" +/+ "x-portable-anymap"),
-       ("pnt", "image" +/+ "x-macpaint"),
-       ("pntg", "image" +/+ "x-macpaint"),
-       ("ppm", "image" +/+ "x-portable-pixmap"),
-       ("ppt", "application" +/+ "vnd.ms-powerpoint"),
-       ("ps", "application" +/+ "postscript"),
-       ("qif", "image" +/+ "x-quicktime"),
-       ("qt", "video" +/+ "quicktime"),
-       ("qti", "image" +/+ "x-quicktime"),
-       ("qtif", "image" +/+ "x-quicktime"),
-       ("ra", "audio" +/+ "x-pn-realaudio"),
-       ("ram", "text" +/+ "uri-list"), ("rar", "application" +/+ "x-rar"),
-       ("ras", "image" +/+ "x-sun-raster"),
-       ("rdf", "application" +/+ "rdf+xml"), ("rgb", "image" +/+ "x-rgb"),
-       ("rm", "application" +/+ "vnd.rn-realmedia"),
-       ("roff", "application" +/+ "x-troff"), ("rtf", "text" +/+ "rtf"),
-       ("rtx", "text" +/+ "richtext"), ("s3m", "audio" +/+ "x-mod"),
-       ("sam", "audio" +/+ "x-mod"), ("sds", "audio" +/+ "x-sds"),
-       ("sf", "audio" +/+ "x-ircam"), ("sgm", "text" +/+ "sgml"),
-       ("sgml", "text" +/+ "sgml"), ("sh", "application" +/+ "x-sh"),
-       ("shar", "application" +/+ "x-shar"),
-       ("shn", "audio" +/+ "x-shorten"), ("sid", "audio" +/+ "x-sid"),
-       ("silo", "model" +/+ "mesh"),
-       ("sit", "application" +/+ "x-stuffit"),
-       ("skd", "application" +/+ "x-koan"),
-       ("skm", "application" +/+ "x-koan"),
-       ("skp", "application" +/+ "x-koan"),
-       ("skt", "application" +/+ "x-koan"),
-       ("smi", "application" +/+ "smil"),
-       ("smil", "application" +/+ "smil"), ("snd", "audio" +/+ "x-au"),
-       ("so", "application" +/+ "octet-stream"),
-       ("spc", "application" +/+ "x-spc"),
-       ("spl", "application" +/+ "x-futuresplash"),
-       ("src", "application" +/+ "x-wais-source"),
-       ("stm", "audio" +/+ "x-mod"), ("stx", "audio" +/+ "x-mod"),
-       ("sv4cpio", "application" +/+ "x-sv4cpio"),
-       ("sv4crc", "application" +/+ "x-sv4crc"),
-       ("svg", "image" +/+ "svg+xml"), ("svx", "audio" +/+ "x-svx"),
-       ("swf", "application" +/+ "x-shockwave-flash"),
-       ("swfl", "application" +/+ "x-shockwave-flash"),
-       ("t", "application" +/+ "x-troff"),
-       ("tar", "application" +/+ "x-tar"),
-       ("tbz", "application" +/+ "x-bzip"),
-       ("tcl", "application" +/+ "x-tcl"),
-       ("tex", "application" +/+ "x-tex"),
-       ("texi", "application" +/+ "x-texinfo"),
-       ("texinfo", "application" +/+ "x-texinfo"),
-       ("tgz", "application" +/+ "x-gzip"), ("tif", "image" +/+ "tiff"),
-       ("tiff", "image" +/+ "tiff"), ("tr", "application" +/+ "x-troff"),
-       ("ts", "video" +/+ "mpegts"),
-       ("tsv", "text" +/+ "tab-separated-values"),
-       ("tta", "audio" +/+ "x-ttafile"), ("txt", "text" +/+ "plain"),
-       ("ult", "audio" +/+ "x-mod"),
-       ("ustar", "application" +/+ "x-ustar"),
-       ("vcd", "application" +/+ "x-cdlink"),
-       ("voc", "audio" +/+ "x-voc"), ("vrml", "model" +/+ "vrml"),
-       ("vxml", "application" +/+ "voicexml+xml"),
-       ("w64", "audio" +/+ "x-w64"), ("wav", "audio" +/+ "x-wav"),
-       ("wbmp", "image" +/+ "vnd.wap.wbmp"),
-       ("wbxml", "application" +/+ "vnd.wap.wbxml"),
-       ("wm", "video" +/+ "x-ms-asf"), ("wma", "video" +/+ "x-ms-asf"),
-       ("wml", "text" +/+ "vnd.wap.wml"),
-       ("wmlc", "application" +/+ "vnd.wap.wmlc"),
-       ("wmls", "text" +/+ "vnd.wap.wmlscript"),
-       ("wmlsc", "application" +/+ "vnd.wap.wmlscriptc"),
-       ("wmv", "video" +/+ "x-ms-asf"), ("wrl", "model" +/+ "vrml"),
-       ("wv", "application" +/+ "x-wavpack"),
-       ("wvc", "application" +/+ "x-wavpack-correction"),
-       ("wvp", "application" +/+ "x-wavpack"),
-       ("xbm", "image" +/+ "x-xbitmap"), ("xcf", "image" +/+ "x-xcf"),
-       ("xht", "application" +/+ "xhtml+xml"),
-       ("xhtml", "application" +/+ "xhtml+xml"),
-       ("xls", "application" +/+ "vnd.ms-excel"),
-       ("xm", "audio" +/+ "x-mod"), ("xml", "application" +/+ "xml"),
-       ("xpm", "image" +/+ "x-xpixmap"), ("xsl", "application" +/+ "xml"),
-       ("xslt", "application" +/+ "xslt+xml"),
-       ("xul", "application" +/+ "vnd.mozilla.xul+xml"),
-       ("xwd", "image" +/+ "x-xwindowdump"),
-       ("xyz", "chemical" +/+ "x-xyz"), ("zip", "application" +/+ "zip")]
+      [("3gp", "application" </> "x-3gp"), ("669", "audio" </> "x-mod"),
+       ("Z", "application" </> "x-compress"),
+       ("a", "application" </> "x-ar"), ("ac3", "audio" </> "x-ac3"),
+       ("ai", "application" </> "postscript"),
+       ("aif", "audio" </> "x-aiff"), ("aifc", "audio" </> "x-aiff"),
+       ("aiff", "audio" </> "x-aiff"), ("amf", "audio" </> "x-mod"),
+       ("anx", "application" </> "ogg"),
+       ("ape", "application" </> "x-ape"), ("asc", "text" </> "plain"),
+       ("asf", "video" </> "x-ms-asf"),
+       ("atom", "application" </> "atom+xml"), ("au", "audio" </> "x-au"),
+       ("avi", "video" </> "x-msvideo"),
+       ("bcpio", "application" </> "x-bcpio"),
+       ("bin", "application" </> "octet-stream"),
+       ("bmp", "image" </> "bmp"), ("bz2", "application" </> "x-bzip"),
+       ("cabal", "text" </> "x-cabal"),
+       ("cdf", "application" </> "x-netcdf"), ("cgm", "image" </> "cgm"),
+       ("class", "application" </> "octet-stream"),
+       ("cpio", "application" </> "x-cpio"),
+       ("cpt", "application" </> "mac-compactpro"),
+       ("csh", "application" </> "x-csh"), ("css", "text" </> "css"),
+       ("dcr", "application" </> "x-director"),
+       ("dif", "video" </> "x-dv"),
+       ("dir", "application" </> "x-director"),
+       ("djv", "image" </> "vnd.djvu"), ("djvu", "image" </> "vnd.djvu"),
+       ("dll", "application" </> "octet-stream"),
+       ("dmg", "application" </> "octet-stream"),
+       ("dms", "application" </> "octet-stream"),
+       ("doc", "application" </> "msword"), ("dsm", "audio" </> "x-mod"),
+       ("dtd", "application" </> "xml-dtd"), ("dv", "video" </> "x-dv"),
+       ("dvi", "application" </> "x-dvi"),
+       ("dxr", "application" </> "x-director"),
+       ("eps", "application" </> "postscript"),
+       ("etx", "text" </> "x-setext"),
+       ("exe", "application" </> "octet-stream"),
+       ("ez", "application" </> "andrew-inset"),
+       ("far", "audio" </> "x-mod"), ("flac", "audio" </> "x-flac"),
+       ("flc", "video" </> "x-fli"), ("fli", "video" </> "x-fli"),
+       ("flv", "video" </> "x-flv"), ("gdm", "audio" </> "x-mod"),
+       ("gif", "image" </> "gif"), ("gram", "application" </> "srgs"),
+       ("grxml", "application" </> "srgs+xml"),
+       ("gtar", "application" </> "x-gtar"),
+       ("gz", "application" </> "x-gzip"),
+       ("hdf", "application" </> "x-hdf"),
+       ("hi", "application" </> "octet-stream"),
+       ("hqx", "application" </> "mac-binhex40"),
+       ("hs", "text" </> "x-haskell"), ("htm", "text" </> "html"),
+       ("html", "text" </> "html"),
+       ("ice", "x-conference" </> "x-cooltalk"),
+       ("ico", "image" </> "x-icon"), ("ics", "text" </> "calendar"),
+       ("ief", "image" </> "ief"), ("ifb", "text" </> "calendar"),
+       ("iff", "audio" </> "x-svx"), ("iges", "model" </> "iges"),
+       ("igs", "model" </> "iges"), ("ilbc", "audio" </> "iLBC-sh"),
+       ("imf", "audio" </> "x-mod"), ("it", "audio" </> "x-mod"),
+       ("jng", "image" </> "x-jng"),
+       ("jnlp", "application" </> "x-java-jnlp-file"),
+       ("jp2", "image" </> "jp2"), ("jpe", "image" </> "jpeg"),
+       ("jpeg", "image" </> "jpeg"), ("jpg", "image" </> "jpeg"),
+       ("js", "application" </> "x-javascript"),
+       ("kar", "audio" </> "midi"),
+       ("latex", "application" </> "x-latex"),
+       ("lha", "application" </> "octet-stream"),
+       ("lzh", "application" </> "octet-stream"),
+       ("m3u", "audio" </> "x-mpegurl"), ("m4a", "audio" </> "mp4a-latm"),
+       ("m4p", "audio" </> "mp4a-latm"),
+       ("m4u", "video" </> "vnd.mpegurl"), ("m4v", "video" </> "mpeg4"),
+       ("mac", "image" </> "x-macpaint"),
+       ("man", "application" </> "x-troff-man"),
+       ("mathml", "application" </> "mathml+xml"),
+       ("me", "application" </> "x-troff-me"),
+       ("med", "audio" </> "x-mod"), ("mesh", "model" </> "mesh"),
+       ("mid", "audio" </> "midi"), ("midi", "audio" </> "midi"),
+       ("mif", "application" </> "vnd.mif"),
+       ("mka", "video" </> "x-matroska"),
+       ("mkv", "video" </> "x-matroska"), ("mng", "video" </> "x-mng"),
+       ("mod", "audio" </> "x-mod"), ("mov", "video" </> "quicktime"),
+       ("movie", "video" </> "x-sgi-movie"), ("mp2", "audio" </> "mpeg"),
+       ("mp3", "audio" </> "mpeg"), ("mp4", "video" </> "mp4"),
+       ("mpc", "audio" </> "x-musepack"), ("mpe", "video" </> "mpeg"),
+       ("mpeg", "video" </> "mpeg"), ("mpg", "video" </> "mpeg"),
+       ("mpga", "audio" </> "mpeg"),
+       ("ms", "application" </> "x-troff-ms"),
+       ("msh", "model" </> "mesh"), ("mtm", "audio" </> "x-mod"),
+       ("mve", "video" </> "x-mve"), ("mxu", "video" </> "vnd.mpegurl"),
+       ("nar", "application" </> "x-nar"),
+       ("nc", "application" </> "x-netcdf"),
+       ("nist", "audio" </> "x-nist"), ("nuv", "video" </> "x-nuv"),
+       ("o", "application" </> "octet-stream"),
+       ("oda", "application" </> "oda"), ("ogg", "application" </> "ogg"),
+       ("ogm", "application" </> "ogg"), ("okt", "audio" </> "x-mod"),
+       ("paf", "audio" </> "x-paris"),
+       ("pbm", "image" </> "x-portable-bitmap"),
+       ("pct", "image" </> "pict"), ("pdb", "chemical" </> "x-pdb"),
+       ("pdf", "application" </> "pdf"),
+       ("pgm", "image" </> "x-portable-graymap"),
+       ("pgn", "application" </> "x-chess-pgn"),
+       ("pic", "image" </> "pict"), ("pict", "image" </> "pict"),
+       ("png", "image" </> "png"),
+       ("pnm", "image" </> "x-portable-anymap"),
+       ("pnt", "image" </> "x-macpaint"),
+       ("pntg", "image" </> "x-macpaint"),
+       ("ppm", "image" </> "x-portable-pixmap"),
+       ("ppt", "application" </> "vnd.ms-powerpoint"),
+       ("ps", "application" </> "postscript"),
+       ("qif", "image" </> "x-quicktime"),
+       ("qt", "video" </> "quicktime"),
+       ("qti", "image" </> "x-quicktime"),
+       ("qtif", "image" </> "x-quicktime"),
+       ("ra", "audio" </> "x-pn-realaudio"),
+       ("ram", "text" </> "uri-list"), ("rar", "application" </> "x-rar"),
+       ("ras", "image" </> "x-sun-raster"),
+       ("rdf", "application" </> "rdf+xml"), ("rgb", "image" </> "x-rgb"),
+       ("rm", "application" </> "vnd.rn-realmedia"),
+       ("roff", "application" </> "x-troff"), ("rtf", "text" </> "rtf"),
+       ("rtx", "text" </> "richtext"), ("s3m", "audio" </> "x-mod"),
+       ("sam", "audio" </> "x-mod"), ("sds", "audio" </> "x-sds"),
+       ("sf", "audio" </> "x-ircam"), ("sgm", "text" </> "sgml"),
+       ("sgml", "text" </> "sgml"), ("sh", "application" </> "x-sh"),
+       ("shar", "application" </> "x-shar"),
+       ("shn", "audio" </> "x-shorten"), ("sid", "audio" </> "x-sid"),
+       ("silo", "model" </> "mesh"),
+       ("sit", "application" </> "x-stuffit"),
+       ("skd", "application" </> "x-koan"),
+       ("skm", "application" </> "x-koan"),
+       ("skp", "application" </> "x-koan"),
+       ("skt", "application" </> "x-koan"),
+       ("smi", "application" </> "smil"),
+       ("smil", "application" </> "smil"), ("snd", "audio" </> "x-au"),
+       ("so", "application" </> "octet-stream"),
+       ("spc", "application" </> "x-spc"),
+       ("spl", "application" </> "x-futuresplash"),
+       ("src", "application" </> "x-wais-source"),
+       ("stm", "audio" </> "x-mod"), ("stx", "audio" </> "x-mod"),
+       ("sv4cpio", "application" </> "x-sv4cpio"),
+       ("sv4crc", "application" </> "x-sv4crc"),
+       ("svg", "image" </> "svg+xml"), ("svx", "audio" </> "x-svx"),
+       ("swf", "application" </> "x-shockwave-flash"),
+       ("swfl", "application" </> "x-shockwave-flash"),
+       ("t", "application" </> "x-troff"),
+       ("tar", "application" </> "x-tar"),
+       ("tbz", "application" </> "x-bzip"),
+       ("tcl", "application" </> "x-tcl"),
+       ("tex", "application" </> "x-tex"),
+       ("texi", "application" </> "x-texinfo"),
+       ("texinfo", "application" </> "x-texinfo"),
+       ("tgz", "application" </> "x-gzip"), ("tif", "image" </> "tiff"),
+       ("tiff", "image" </> "tiff"), ("tr", "application" </> "x-troff"),
+       ("ts", "video" </> "mpegts"),
+       ("tsv", "text" </> "tab-separated-values"),
+       ("tta", "audio" </> "x-ttafile"), ("txt", "text" </> "plain"),
+       ("ult", "audio" </> "x-mod"),
+       ("ustar", "application" </> "x-ustar"),
+       ("vcd", "application" </> "x-cdlink"),
+       ("voc", "audio" </> "x-voc"), ("vrml", "model" </> "vrml"),
+       ("vxml", "application" </> "voicexml+xml"),
+       ("w64", "audio" </> "x-w64"), ("wav", "audio" </> "x-wav"),
+       ("wbmp", "image" </> "vnd.wap.wbmp"),
+       ("wbxml", "application" </> "vnd.wap.wbxml"),
+       ("wm", "video" </> "x-ms-asf"), ("wma", "video" </> "x-ms-asf"),
+       ("wml", "text" </> "vnd.wap.wml"),
+       ("wmlc", "application" </> "vnd.wap.wmlc"),
+       ("wmls", "text" </> "vnd.wap.wmlscript"),
+       ("wmlsc", "application" </> "vnd.wap.wmlscriptc"),
+       ("wmv", "video" </> "x-ms-asf"), ("wrl", "model" </> "vrml"),
+       ("wv", "application" </> "x-wavpack"),
+       ("wvc", "application" </> "x-wavpack-correction"),
+       ("wvp", "application" </> "x-wavpack"),
+       ("xbm", "image" </> "x-xbitmap"), ("xcf", "image" </> "x-xcf"),
+       ("xht", "application" </> "xhtml+xml"),
+       ("xhtml", "application" </> "xhtml+xml"),
+       ("xls", "application" </> "vnd.ms-excel"),
+       ("xm", "audio" </> "x-mod"), ("xml", "application" </> "xml"),
+       ("xpm", "image" </> "x-xpixmap"), ("xsl", "application" </> "xml"),
+       ("xslt", "application" </> "xslt+xml"),
+       ("xul", "application" </> "vnd.mozilla.xul+xml"),
+       ("xwd", "image" </> "x-xwindowdump"),
+       ("xyz", "chemical" </> "x-xyz"), ("zip", "application" </> "zip")]
index 12f19e0684748eb7bccfa229e670fb80f9b91e57..db51e65cdce31d6bef85c93aeb32fe786ed51af1 100644 (file)
@@ -102,16 +102,16 @@ outputExtMapAsHS extMap fpath
       mimeToExp (MIMEType maj min params)
           = foldl appendParam (HsInfixApp
                                (HsLit (HsString maj))
-                               (HsQVarOp (UnQual (HsSymbol "+/+")))
+                               (HsQVarOp (UnQual (HsSymbol "</>")))
                                (HsLit (HsString min))) params
 
       appendParam :: HsExp -> (String, String) -> HsExp
       appendParam x param
-          = HsInfixApp x (HsQVarOp (UnQual (HsSymbol "+:+"))) $ paramToExp param
+          = HsInfixApp x (HsQVarOp (UnQual (HsSymbol "<:>"))) $ paramToExp param
 
       paramToExp :: (String, String) -> HsExp
       paramToExp (name, value)
           = HsInfixApp
             (HsLit (HsString name))
-            (HsQVarOp (UnQual (HsSymbol "+=+")))
+            (HsQVarOp (UnQual (HsSymbol "<=>")))
             (HsLit (HsString value))
\ No newline at end of file
index e4fa662688ad24ccdf642283f0790350779ad659..9cd8d0b49e585924cf04fdd87501ecd3c8527ace 100644 (file)
@@ -180,7 +180,7 @@ runResource def itr
                            -- FIXME: 同じ名前で複數の値があった時は、こ
                            -- れではまずいと思ふ。
                            mapM_ (\ (name, value) -> setHeader name value) $ aboHeaders abo
-                           setContentType ("application" +/+ "xhtml+xml")
+                           setContentType ("application" </> "xhtml+xml")
                            output $ abortPage conf reqM resM abo
                  else
                    hPutStrLn stderr $ show abo
index 54d57b2972abe824cfd1d1931a1682a87d531a24..5a7c3a5fa2fe28a3ea5bd8b33ea97a64512892f0 100644 (file)
@@ -78,8 +78,8 @@ data Response = Response {
       resVersion :: HttpVersion
     , resStatus  :: StatusCode
     , resHeaders :: Headers
-    }
-                deriving (Show, Eq)
+    } deriving (Show, Eq)
+
 
 instance HasHeaders Response where
     getHeaders = resHeaders
index 20be0ce1a9969dd4dc49fd0bfe5b4984fdb0ae06..d584009c61cd3f4411836e18f2d0e299741ded70 100644 (file)
@@ -21,9 +21,6 @@ main = let config    = defaultConfig { cnfServerPort = PortNumber 9999 }
            resources = mkResTree [ ( []
                                    , helloWorld )
 
-                                 , ( ["index.html"]
-                                   , staticFile "/Users/admin/Sites/index.html" )
-
                                  , ( ["urandom"]
                                    , staticFile "/dev/urandom" )
 
@@ -43,7 +40,7 @@ helloWorld
       , resGet
           = Just $ do --time <- liftIO $ getClockTime
                       --foundEntity (strongETag "abcde") time
-                      setContentType $ "text" +/+ "hello"
+                      setContentType $ "text" </> "hello"
                       outputChunk "Hello, "
                       outputChunk "World!\n"
       , resHead   = Nothing
@@ -51,7 +48,7 @@ helloWorld
           = Just $ do str1 <- inputChunk 3
                       str2 <- inputChunk 3
                       str3 <- inputChunk 3
-                      setContentType $ "text" +/+ "hello"
+                      setContentType $ "text" </> "hello"
                       output ("[" ++ str1 ++ " - " ++ str2 ++ "#" ++ str3 ++ "]")
       , resPut    = Nothing
       , resDelete = Nothing