import Network.HTTP.Lucu.Resource.Tree
import Network.HTTP.Lucu.ResponseWriter
import Network.HTTP.Lucu.SocketLike as SL
+import Prelude.Unicode
-- |This is the entry point of Lucu httpd. It listens to a socket and
-- waits for clients. 'runHttpd' never stops by itself so the only way
-- Example:
--
-- > {-# LANGUAGE OverloadedStrings #-}
+-- > {-# LANGUAGE QuasiQuotes #-}
-- > module Main where
-- > import Network.HTTP.Lucu
-- >
-- > 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 ()
launchListener so
= do p ← SL.socketPort so
-- FIXME: Don't throw away the thread ID as we can't
- -- kill it later then. [1]
- void $ forkIO $ httpLoop p so
+ -- kill it later then.
+ void ∘ forkIO $ httpLoop p so
listenOn ∷ Family → HostName → ServiceName → IO Socket
listenOn fam host srv