Add hoistR
commit33e80ff3941343681581b27eb54afd20ba38ae9d
authorAli Abrar <aliabrar@gmail.com>
dateSun 20 Jan 2019, 20:40 (8 years ago)
parent4cdeba6
lib/route/src/Obelisk/Route.hs+4
@@ -19,6 +19,7 @@
1919module Obelisk.Route
2020 ( R
2121 , pattern (:/)
22+ , hoistR
2223 , PageName
2324 , PathQuery
2425 , Encoder
@@ -149,6 +150,9 @@ pattern a :/ b = a :=> Identity b
149150mapSome :: (forall a. f a -> g a) -> Some f -> Some g
150151mapSome f (Some.This a) = Some.This $ f a
151152
153+hoistR :: (forall x. f x -> g x) -> R f -> R g
154+hoistR f (x :=> Identity y) = f x :/ y
155+
152156--------------------------------------------------------------------------------
153157-- Encoder fundamentals
154158--------------------------------------------------------------------------------