From 4897c24d3fab3c7fc6f278f64dfce8bde1970f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=ADaz?= Date: Tue, 11 Aug 2015 22:07:28 +0200 Subject: [PATCH] Use CPP to adapt to template-haskell changes according to the version of base used. --- yesod-core/Yesod/Core/Internal/TH.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yesod-core/Yesod/Core/Internal/TH.hs b/yesod-core/Yesod/Core/Internal/TH.hs index d118809d..2fc1ea53 100644 --- a/yesod-core/Yesod/Core/Internal/TH.hs +++ b/yesod-core/Yesod/Core/Internal/TH.hs @@ -3,6 +3,7 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE CPP #-} module Yesod.Core.Internal.TH where import Prelude hiding (exp) @@ -94,7 +95,13 @@ mkYesodGeneral name args isSub resS = do case arg of Left t -> ( ConT (mkName t):xs, n:ns, cs ) Right ts -> ( VarT n :xs, ns - , fmap (\t -> AppT (ConT $ mkName t) (VarT n)) ts ++ cs ) + , fmap (\t -> +#if MIN_VERSION_base(4,8,0) + AppT (ConT $ mkName t) (VarT n) +#else + ClassP (mkName t) [VarT n] +#endif + ) ts ++ cs ) ) ([],vns,[]) args site = foldl' AppT (ConT $ mkName name) argtypes res = map (fmap parseType) resS