aboutsummaryrefslogtreecommitdiff
path: root/Utility/Yesod.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-06-03 13:51:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-06-03 13:51:54 -0400
commitc4e38c013f61d9b3482eb5592619e619d67b9146 (patch)
treeb44f7f2d7b67fdb674ded53db95d2ad3856b88fb /Utility/Yesod.hs
parent55276e3be82cb574d5bb5964cbfbbb6e37f5dff2 (diff)
add liftH shim between yesod versions, to avoid needing zillions of ifdefs
Diffstat (limited to 'Utility/Yesod.hs')
-rw-r--r--Utility/Yesod.hs19
1 files changed, 17 insertions, 2 deletions
diff --git a/Utility/Yesod.hs b/Utility/Yesod.hs
index 4f7fea8b5..ef9ad5fc5 100644
--- a/Utility/Yesod.hs
+++ b/Utility/Yesod.hs
@@ -1,11 +1,14 @@
{- Yesod stuff, that's typically found in the scaffolded site.
-
- - Copyright 2012 Joey Hess <joey@kitenet.net>
+ - Also a bit of a compatability layer to make it easier to support yesod
+ - 1.1 and 1.2 in the same code base.
+ -
+ - Copyright 2012, 2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE CPP #-}
+{-# LANGUAGE CPP, RankNTypes #-}
module Utility.Yesod where
@@ -16,6 +19,9 @@ import Language.Haskell.TH.Syntax
import Data.Default (def)
import Text.Hamlet
#endif
+#if MIN_VERSION_yesod_default(1,2,0)
+import Yesod.Core
+#endif
widgetFile :: String -> Q Exp
#if ! MIN_VERSION_yesod_default(1,1,0)
@@ -31,3 +37,12 @@ widgetFile = widgetFileNoReload $ def
hamletTemplate :: FilePath -> FilePath
hamletTemplate f = globFile "hamlet" f
#endif
+
+{- Lift Handler to Widget -}
+#if ! MIN_VERSION_yesod(1,2,0)
+liftH :: forall t. Lift t => t -> Q Exp
+liftH = lift
+#else
+liftH :: Monad m => HandlerT site m a -> WidgetT site m a
+liftH = liftH
+#endif