on master help sign in
route: Add convenience function
commit26150156832f5182c646e1bb42d53e7f6a3bcc90 authorTom Smalley <tfsmalley@gmail.com> dateTue 18 Jun 2019, 15:26 (7 years ago) parent86a9584
2 files changed+6
ChangeLog.md+1 lib/route/src/Obelisk/Route.hs+5
ChangeLog.md+1
@@ -9,6 +9,7 @@ This project's release branch is `master`. This log is written from the perspect
99* The backend no longer runs in BackendConfigsT.
1010* Add tabulation package. See Data.Tabulation for details.
1111* Add encoders for `DMap`, `HasFields` (cf. Data.Tabulation), and JSON.
12+* Add `?/`, a convenience function for constructing routes nested in `Maybe`.
1213
1314## v0.1.1.0 - 2019-05-17
1415
lib/route/src/Obelisk/Route.hs+5
@@ -20,6 +20,7 @@
2020module Obelisk.Route
2121 ( R
2222 , pattern (:/)
23+ , (?/)
2324 , hoistR
2425 , PageName
2526 , PathQuery
@@ -163,6 +164,10 @@ infixr 5 :/
163164pattern (:/) :: f a -> a -> R f
164165pattern a :/ b = a :=> Identity b
165166
167+infixr 5 ?/
168+(?/) :: f (Maybe a) -> a -> R f
169+r ?/ a = r :/ Just a
170+
166171mapSome :: (forall a. f a -> g a) -> Some f -> Some g
167172mapSome f (Some a) = Some $ f a
168173