summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-10-23 20:26:46 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-10-23 20:26:46 -0400
commit1324ab995d28daf0eabe520723f917ca55e0e223 (patch)
treeb5077d84899d86e32015ce79a38d61f7d7d61644
parent9e33f1b88503eae29797f171ba219cba1f34325a (diff)
deal with yesod's second gratuitous rename of the same function in a year
-rw-r--r--Utility/Yesod.hs22
1 files changed, 17 insertions, 5 deletions
diff --git a/Utility/Yesod.hs b/Utility/Yesod.hs
index afe10a111..348af7f2f 100644
--- a/Utility/Yesod.hs
+++ b/Utility/Yesod.hs
@@ -1,9 +1,9 @@
{- Yesod stuff, that's typically found in the scaffolded site.
-
- Also a bit of a compatability layer to make it easier to support yesod
- - 1.1 and 1.2 in the same code base.
+ - 1.1-1.4 in the same code base.
-
- - Copyright 2012, 2013 Joey Hess <joey@kitenet.net>
+ - Copyright 2012-2014 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -17,8 +17,10 @@ module Utility.Yesod
, widgetFile
, hamletTemplate
#endif
+#if ! MIN_VERSION_yesod(1,4,0)
+ , withUrlRenderer
+#endif
#if ! MIN_VERSION_yesod(1,2,0)
- , giveUrlRenderer
, Html
#endif
) where
@@ -41,6 +43,11 @@ import Data.Default (def)
import Text.Hamlet hiding (Html)
#endif
#endif
+#if ! MIN_VERSION_yesod(1,4,0)
+#if MIN_VERSION_yesod(1,2,0)
+import Data.Text (Text)
+#endif
+#endif
#ifndef __NO_TH__
widgetFile :: String -> Q Exp
@@ -69,8 +76,13 @@ liftH = lift
{- Misc new names for stuff. -}
#if ! MIN_VERSION_yesod(1,2,0)
-giveUrlRenderer :: forall master sub. HtmlUrl (Route master) -> GHandler sub master RepHtml
-giveUrlRenderer = hamletToRepHtml
+withUrlRenderer :: forall master sub. HtmlUrl (Route master) -> GHandler sub master RepHtml
+withUrlRenderer = hamletToRepHtml
type Html = RepHtml
+#else
+#if ! MIN_VERSION_yesod(1,4,0)
+withUrlRenderer :: MonadHandler m => ((Route (HandlerSite m) -> [(Text, Text)] -> Text) -> output) -> m output
+withUrlRenderer = giveUrlRenderer
+#endif
#endif