diff --git a/wai-extra/ChangeLog.md b/wai-extra/ChangeLog.md index 7e4a14638..17a214e84 100644 --- a/wai-extra/ChangeLog.md +++ b/wai-extra/ChangeLog.md @@ -1,5 +1,9 @@ # Changelog for wai-extra +## 3.1.18 + +* Added instances `Foldable` and `Traversable` for `UrlMap'` [#992](https://github.com/yesodweb/wai/pull/992) + ## 3.1.17 * Started deprecation of `data-default` [#1011](https://github.com/yesodweb/wai/pull/1011) diff --git a/wai-extra/Network/Wai/UrlMap.hs b/wai-extra/Network/Wai/UrlMap.hs index 96cc54f25..ad26fbbb3 100644 --- a/wai-extra/Network/Wai/UrlMap.hs +++ b/wai-extra/Network/Wai/UrlMap.hs @@ -52,6 +52,14 @@ instance Alternative UrlMap' where empty = UrlMap' empty (UrlMap' xs) <|> (UrlMap' ys) = UrlMap' (xs <|> ys) +-- | @since 3.1.18 +instance Foldable UrlMap' where + foldr f z (UrlMap' xs) = foldr (f . snd) z xs + +-- | @since 3.1.18 +instance Traversable UrlMap' where + traverse f (UrlMap' xs) = UrlMap' <$> traverse (traverse f) xs + type UrlMap = UrlMap' Application -- | Mount an application under a given path. The ToApplication typeclass gives diff --git a/wai-extra/wai-extra.cabal b/wai-extra/wai-extra.cabal index 22d9a08b1..c42a8921e 100644 --- a/wai-extra/wai-extra.cabal +++ b/wai-extra/wai-extra.cabal @@ -1,5 +1,5 @@ Name: wai-extra -Version: 3.1.17 +Version: 3.1.18 Synopsis: Provides some basic WAI handlers and middleware. description: Provides basic WAI handler and middleware functionality: