Skip to content

Commit

Permalink
Merge pull request #992 from chris-martin/urlmap-traversable
Browse files Browse the repository at this point in the history
add instance Traversable UrlMap'
  • Loading branch information
kazu-yamamoto authored Nov 7, 2024
2 parents ecb72d0 + 60e291b commit 931eeb1
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.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)
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.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
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.17
Version: 3.1.18
Synopsis: Provides some basic WAI handlers and middleware.
description:
Provides basic WAI handler and middleware functionality:
Expand Down

0 comments on commit 931eeb1

Please sign in to comment.