add liftH shim between yesod versions, to avoid needing zillions of ifdefs
This commit is contained in:
parent
79fd677805
commit
31753bad46
16 changed files with 66 additions and 51 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue