]> gitweb @ CieloNegro.org - Lucu.git/commitdiff
Added new example.
authorpho <pho@cielonegro.org>
Thu, 4 Oct 2007 09:31:35 +0000 (18:31 +0900)
committerpho <pho@cielonegro.org>
Thu, 4 Oct 2007 09:31:35 +0000 (18:31 +0900)
darcs-hash:20071004093135-62b54-83bbefeb2040867e4bbb8fb1d168861bc5fe07e2.gz

.boring
Network/HTTP/Lucu/Response.hs
examples/ImplantedSmall.hs [new file with mode: 0644]
examples/Makefile
examples/small-file.txt [new file with mode: 0644]

diff --git a/.boring b/.boring
index 2591e26213774f374c188a1bef6601d46f50ceda..884352488b1c8d6407e386ed6aae768098b7adc8 100644 (file)
--- a/.boring
+++ b/.boring
@@ -56,4 +56,6 @@
 
 ^examples/HelloWorld$
 ^examples/Implanted$
+^examples/ImplantedSmall$
 ^examples/MiseRafturai\.hs$
+^examples/SmallFile\.hs$
index 573b98d21e8341d0467cbd3bd36b32ccc182f781..b1ad3d8df4a914b1a7900e4d7463a19902421863 100644 (file)
@@ -135,9 +135,8 @@ isServerError = doesMeet (>= 500)
 
 
 doesMeet :: (Int -> Bool) -> StatusCode -> Bool
-doesMeet p sc = let (# num, _ #) = statusCode sc
-                in
-                  p num
+doesMeet p sc = case statusCode sc of
+                  (# num, _ #) -> p num
 
 
 -- |@'statusCode' sc@ returns an unboxed tuple of numeric and textual
diff --git a/examples/ImplantedSmall.hs b/examples/ImplantedSmall.hs
new file mode 100644 (file)
index 0000000..1a65211
--- /dev/null
@@ -0,0 +1,11 @@
+import Network
+import Network.HTTP.Lucu
+import SmallFile
+
+main :: IO ()
+main = let config    = defaultConfig { cnfServerPort = PortNumber 9999 }
+           resources = mkResTree [ ([], smallFile) ]
+       in
+         do putStrLn "Access http://localhost:9999/ with your browser."
+            runHttpd config resources
+                                   
\ No newline at end of file
index 02537764fcd3680dc614a616c4316848c5decab0..2727e6404854808c9a8c1ca4013121b2d7705a30 100644 (file)
@@ -1,14 +1,18 @@
-build: MiseRafturai.hs
-       ghc --make HelloWorld -threaded -O3
-       ghc --make Implanted -threaded -O3
+build: MiseRafturai.hs SmallFile.hs
+       ghc --make HelloWorld -threaded -O3 -fwarn-unused-imports
+       ghc --make Implanted -threaded -O3 -fwarn-unused-imports
+       ghc --make ImplantedSmall -threaded -O3 -fwarn-unused-imports
 
 run: build
        ./HelloWorld
 
 clean:
-       rm -f HelloWorld Implanted MiseRafturai.hs *.hi *.o
+       rm -f HelloWorld Implanted MiseRafturai.hs ImplantedSmall SmallFile.hs *.hi *.o
 
 MiseRafturai.hs: mise-rafturai.html
        lucu-implant-file -m MiseRafturai -o $@ $<
 
-.PHONY: build run clean
\ No newline at end of file
+SmallFile.hs: small-file.txt
+       lucu-implant-file -m SmallFile -o $@ $<
+
+.PHONY: build run clean
diff --git a/examples/small-file.txt b/examples/small-file.txt
new file mode 100644 (file)
index 0000000..af5626b
--- /dev/null
@@ -0,0 +1 @@
+Hello, world!