+-- |@insert a b@ first tries @a@, and then tries @b@. @insertMany bs
+-- a@ first tries @a@, and then tries each one in @bs@ from head to
+-- tail.
+instance Dispatchable α ⇒ Unfoldable Dispatcher α where
+ {-# INLINEABLE insert #-}
+ insert a (Dispatcher b)
+ = dispatcher
+ $ \uri → do r ← dispatch a uri
+ case r of
+ Just _ → return r
+ Nothing → dispatch b uri
+ {-# INLINE empty #-}
+ empty = dispatcher e
+ where
+ e ∷ URI → IO (Maybe Resource)
+ {-# INLINE e #-}
+ e = return ∘ const Nothing
+ {-# INLINE singleton #-}
+ singleton = dispatcher
+
+-- |@a `'mappend'` b@ first tries @a@, and then tries @b@.