From: pho Date: Thu, 4 Oct 2007 09:31:35 +0000 (+0900) Subject: Added new example. X-Git-Tag: RELEASE-0_2_1~25 X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=ea8f823ffa1004582d403c69f52a83e20486269f;p=Lucu.git Added new example. darcs-hash:20071004093135-62b54-83bbefeb2040867e4bbb8fb1d168861bc5fe07e2.gz --- diff --git a/.boring b/.boring index 2591e26..8843524 100644 --- a/.boring +++ b/.boring @@ -56,4 +56,6 @@ ^examples/HelloWorld$ ^examples/Implanted$ +^examples/ImplantedSmall$ ^examples/MiseRafturai\.hs$ +^examples/SmallFile\.hs$ diff --git a/Network/HTTP/Lucu/Response.hs b/Network/HTTP/Lucu/Response.hs index 573b98d..b1ad3d8 100644 --- a/Network/HTTP/Lucu/Response.hs +++ b/Network/HTTP/Lucu/Response.hs @@ -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 index 0000000..1a65211 --- /dev/null +++ b/examples/ImplantedSmall.hs @@ -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 diff --git a/examples/Makefile b/examples/Makefile index 0253776..2727e64 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -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 index 0000000..af5626b --- /dev/null +++ b/examples/small-file.txt @@ -0,0 +1 @@ +Hello, world!