Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add instance Traversable UrlMap' #992

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading