deal with yesod's second gratuitous rename of the same function in a year

This commit is contained in:
Joey Hess 2014-10-23 20:26:46 -04:00
parent 31a1f061c6
commit ce9076370e
7 changed files with 23 additions and 11 deletions

View file

@ -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