Skip to content

Commit

Permalink
add instance Traversable UrlMap'
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-martin committed Oct 10, 2024
1 parent ec5e017 commit 4f31305
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 4 additions & 0 deletions wai-extra/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for wai-extra

## 3.1.16

* Added instances `Foldable` and `Traversable` for `UrlMap'` [#992](https://github.com/yesodweb/wai/pull/992)

## 3.1.15

* Added `validateHeadersMiddleware` for validating response headers set by the application [#990](https://github.com/yesodweb/wai/pull/990).
Expand Down
8 changes: 8 additions & 0 deletions wai-extra/Network/Wai/UrlMap.hs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ instance Alternative UrlMap' where
empty = UrlMap' empty
(UrlMap' xs) <|> (UrlMap' ys) = UrlMap' (xs <|> ys)

-- | @since 3.1.16
instance Foldable UrlMap' where
foldr f z (UrlMap' xs) = foldr (f . snd) z xs

-- | @since 3.1.16
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
Expand Down
2 changes: 1 addition & 1 deletion wai-extra/wai-extra.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Name: wai-extra
Version: 3.1.15
Version: 3.1.16
Synopsis: Provides some basic WAI handlers and middleware.
description:
Provides basic WAI handler and middleware functionality:
Expand Down

0 comments on commit 4f31305

Please sign in to comment.