, runRouter
-- * Testing for URI scheme
- , schemeWith
+ , anyScheme
, scheme
, http
, http'
runRouter = ((listToMaybe <$>) ∘) ∘ runListTArrow ∘ unRouter
-- |FIXME: doc
-schemeWith ∷ (ArrowChoice (⇝), ArrowZero (⇝))
- ⇒ (CIAscii → Bool)
- → URI ⇝ (Host, Path)
-{-# INLINEABLE schemeWith #-}
-schemeWith f
+anyScheme ∷ Arrow (⇝) ⇒ URI ⇝ (Host, Path)
+{-# INLINEABLE anyScheme #-}
+anyScheme = arr uriHost &&& arr uriPathSegments
+
+-- |FIXME: doc
+scheme ∷ (ArrowChoice (⇝), ArrowZero (⇝)) ⇒ CIAscii → URI ⇝ (Host, Path)
+{-# INLINEABLE scheme #-}
+scheme s
= proc uri →
- if f (uriCIScheme uri) then
- arr uriHost &&& arr uriPathSegments ⤙ uri
+ if s ≡ uriCIScheme uri then
+ anyScheme ⤙ uri
else
zeroArrow ⤙ (⊥)
--- |@'scheme' s@ = @'schemeWith' ('==' s)@
-scheme ∷ (ArrowChoice (⇝), ArrowZero (⇝)) ⇒ CIAscii → URI ⇝ (Host, Path)
-{-# INLINE scheme #-}
-scheme = schemeWith ∘ (≡)
-
-- |@'http' = 'scheme' \"http\" '<+>' 'scheme' \"https\"@
http ∷ (ArrowChoice (⇝), ArrowPlus (⇝), ArrowZero (⇝)) ⇒ URI ⇝ (Host, Path)
{-# 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"