-- 'Network.HTTP.Lucu.putChunk' \"Hello, world!\"
-- }
-- @
+-- FIXME: use monad-parallel's MonadFork instead of IO.
runHttpd ∷ HostMapper α ⇒ Config → α → IO ()
runHttpd cnf hm
= do let launchers
, runRouter
-- * Testing for URI scheme
+ , anyScheme
, schemeWith
, scheme
, http
{-# INLINE runRouter #-}
runRouter = ((listToMaybe <$>) ∘) ∘ runListTArrow ∘ unRouter
+-- |FIXME: doc
+anyScheme ∷ Arrow (⇝) ⇒ URI ⇝ (Host, Path)
+{-# INLINEABLE anyScheme #-}
+anyScheme = arr uriHost &&& arr uriPathSegments
+
-- |FIXME: doc
schemeWith ∷ (ArrowChoice (⇝), ArrowZero (⇝))
⇒ (CIAscii → Bool)
schemeWith f
= proc uri →
if f (uriCIScheme uri) then
- arr uriHost &&& arr uriPathSegments ⤙ uri
+ anyScheme ⤙ uri
else
zeroArrow ⤙ (⊥)
{-# INLINE http #-}
http = scheme "http" <+> scheme "https"
--- |@'http'' = 'scheme' \"http\"
+-- |@'http'' = 'scheme' \"http\"@
http' ∷ (ArrowChoice (⇝), ArrowZero (⇝)) ⇒ URI ⇝ (Host, Path)
http' = scheme "http"
--- |@'https' = 'scheme' \"https\"
+-- |@'https' = 'scheme' \"https\"@
https ∷ (ArrowChoice (⇝), ArrowZero (⇝)) ⇒ URI ⇝ (Host, Path)
https = scheme "https"