From: PHO Date: Sat, 12 Nov 2011 17:46:52 +0000 (+0900) Subject: examples/*.hs should use mimeType quasi-quoter. X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=8a7649cdf5d96d511dd6e2dfa4e2b741ffac4f9a;p=Lucu.git examples/*.hs should use mimeType quasi-quoter. --- diff --git a/Network/HTTP/Lucu/Httpd.hs b/Network/HTTP/Lucu/Httpd.hs index 883a9a6..3f2d733 100644 --- a/Network/HTTP/Lucu/Httpd.hs +++ b/Network/HTTP/Lucu/Httpd.hs @@ -29,6 +29,7 @@ import Network.HTTP.Lucu.SocketLike as SL -- Example: -- -- > {-# LANGUAGE OverloadedStrings #-} +-- > {-# LANGUAGE QuasiQuotes #-} -- > module Main where -- > import Network.HTTP.Lucu -- > @@ -41,7 +42,7 @@ import Network.HTTP.Lucu.SocketLike as SL -- > helloWorld :: ResourceDef -- > helloWorld = emptyResource { -- > resGet --- > = Just $ do setContentType $ parseMIMEType "text/plain" +-- > = Just $ do setContentType [mimeType| text/plain |] -- > putChunk "Hello, world!" -- > } runHttpd ∷ Config → ResTree → [FallbackHandler] → IO () diff --git a/examples/HelloWorld.hs b/examples/HelloWorld.hs index d7e0071..f8a4721 100644 --- a/examples/HelloWorld.hs +++ b/examples/HelloWorld.hs @@ -1,5 +1,6 @@ {-# LANGUAGE OverloadedStrings + , QuasiQuotes , UnicodeSyntax #-} import Control.Applicative @@ -26,7 +27,7 @@ helloWorld ∷ ResourceDef helloWorld = emptyResource { resGet - = Just $ do setContentType $ parseMIMEType "text/hello" + = Just $ do setContentType [mimeType| text/hello |] putChunk "Hello, " putChunk "World!\n" putChunks =≪ Lazy.pack <$> getRemoteAddr' @@ -34,6 +35,6 @@ helloWorld = Just $ do str1 ← getChunk 3 str2 ← getChunk 3 str3 ← getChunk 3 - setContentType $ parseMIMEType "text/hello" + setContentType [mimeType| text/hello |] putChunks $ Lazy.fromChunks ["[", str1, " - ", str2, "#", str3, "]"] } diff --git a/examples/SSL.hs b/examples/SSL.hs index 6df2ab7..b9b76a3 100644 --- a/examples/SSL.hs +++ b/examples/SSL.hs @@ -1,6 +1,7 @@ {-# LANGUAGE OverloadedStrings , PackageImports + , QuasiQuotes , UnicodeSyntax #-} import Control.Applicative @@ -40,7 +41,7 @@ helloWorld ∷ ResourceDef helloWorld = emptyResource { resGet - = Just $ do setContentType $ parseMIMEType "text/plain" + = Just $ do setContentType [mimeType| text/plain |] putChunk "getRemoteCertificate = " cert ← do cert ← getRemoteCertificate case cert of